in reply to Win32::OLE and WMI

Here is my tested similar script, so you can learn by example.
(please ignore irrelevant non-English comments there)
use Win32::OLE; $ADsPath = "WinNT://VAD/lanmanserver"; $c = Win32::OLE->GetObject($ADsPath) or die "Невозможно получить $ADsP +ath\n"; $s = $c->Create("fileshare",'ddd-doom'); $s->{path} = 'C:\DOOM2'; $s->{description} = "This is a Perl created share"; $s->SetInfo();
... and another one ...
use Win32::OLE; $ADsPath = "WinNT://RU0028/VAD,computer"; $c = Win32::OLE->GetObject($ADsPath) or die "Невозможно получить $ADsP +ath\n"; # создаем и возвращаем объект User $u = $c->Create("user","xx"); $u->SetInfo(); # нужно создать пользователя, перед тем как менять зна +чения # в пространстве имен WinNT: пробел между "Full" и "Name" недопустим $u->{FullName} = "XXX-user!"; $su->SetInfo();

Courage, the Cowardly Dog

Replies are listed 'Best First'.
Re: Re: Win32::OLE and WMI
by grmm2 (Acolyte) on Feb 02, 2004 at 15:14 UTC
    Thanks for your reply. You've demonstrated how to create a share, and I have no difficulty with this, myself. My problem is with retrieving the security descriptor for an existing share or file via the GetSecurityDescriptor method. Have you ever tried this yourself?
      It is easy to change my script to do the reverse:
      use Win32::OLE; $ADsPath = "WinNT://VAD-MM/lanmanserver"; $c = Win32::OLE->GetObject($ADsPath) or die "Невозможно получить $ADsP +ath\n"; print map {"[$_->{path}=$_->{description}]\n"} in $c;
      outputs on my machine "vad-mm" (you should substitute your machine of interest there of course)
      [C:\=] [D:\=]
      I am not WMI expert and do not know how to use GetSecurityDescriptor method without reading proper documentation, but I do know that an example shown by me uses WMI and may be it could solve your problem as well?

      Let me know if something should be clarified better.

      Courage, the Cowardly Dog

        Thanks for trying to help, Courage. I've been using WMI with perl for a long time and the basic stuff all works very nicely. I think my crux of the problem is that this is the first time that I have tried to return an object from an OLE call where the object reference is supplied as an argument rather than as a result of the call. ie. This always works:
        $objectIwant = $otherobject->Method();
        but this does not:
        $returncode = $otherobject->Method($objectIwant);