Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I understand this may not be the best place to ask this, but I'm about fed up with ADSI.

I'm trying to create a utility that will add to the IPSecurity/IPGrant/IPDeny array in ADSI. Using the Win32::OLE module, I have this code:

use strict; use Win32::OLE; use Win32::OLE::Enum; use Carp; eval { my $newip = ","; Win32::OLE->Option(Warn => 3); my $secobj = Win32::OLE->GetObject("IIS://ogre/W3svc/1/Root") or +croak "Couldn't get object: $!\n"; my $MyIPSec = $secobj->{IPSecurity}; my $ref_IPList = $MyIPSec->{IPGrant}; my @IPList = @{$ref_IPList}; foreach my $i (@IPList) { print "Granted IP: $i\n"; } push(@IPList,$newip); my $ref_newIPList = \@IPList; $MyIPSec->IPGrant = \@IPList or croak "ERROR: Couldn't set variab +le: $!\n"; # $MyIPSec->SetProperty("IPDeny",$ref_newIPList) or croak "ERROR: + Couldn't SetProperty: $!\n"; # $MyIPSec->{IPGrant}->create($newip) or croak "ERROR: Couldn't cr +eate new grant: $!\n"; # $obj_grant->($newip) or croak "ERROR: Couldn't create new grant: +$!\n"; # $MyIPSec->IPGrant(@IPList) or carp "Couldn't do SetInfo: $!\n"; $MyIPSec->SetProperty("IPGrant",$ref_IPList) or carp "WARNING: Cou +ldn't SetInfo(): ".Win32::OLE->LastError().".\n"; my $secobjnew = Win32::OLE->GetObject("IIS://ogre/W3svc/1/Root") o +r croak "Couldn't get object: $!\n"; my $MyIPSecnew = $secobjnew->{IPSecurity}; foreach my $newip (@{$MyIPSecnew->{IPGrant}}) { print "IP Granted (new): $newip\n"; } }; print Win32::OLE->LastError()."\n" if (Win32::OLE->LastError());

As you can probably see, I have tried almost every method I can think of to set the $MyIPSec->IPGrant Property/Method to the correct value. I can get my script to recognize the right data, and return it when I dereference the array returned by $MyIPSec->{IPGrant}. The right data, however, is never committed to the server.

J. J. Horner
Linux, Perl, Apache, Stronghold, Unix

In reply to IIS/ADSI/Win32-OLE by jjhorner

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (1)
As of 2023-09-28 02:08 GMT
Find Nodes?
    Voting Booth?

    No recent polls found