jpavel has asked for the wisdom of the Perl Monks concerning the following question:
I want to be able to do a similar bind to WINNT where I can use an alternate moniker than what I'm logged in with (as above). The only way I know to change a password using OLE is:@host = ($server,"root/cimv2",$user,$password); $localWMI = Win32::OLE->new('WbemScripting.SWbemLocator') or die "Cann +ot access WMI on local machine: ", Win32::OLE->LastError; $WMI = $localWMI->ConnectServer(@host) or die "Cannot access WMI on re +mote machine: ", Win32::OLE->LastError;
But this only uses the logged in credentials as a moniker. Is there a host array I can use to supply different credentials to connect to WINNT instead of root\cimv2? Or is there another way I can change a password of a user (it doesn't seem as if the Win32_User object has any methods associated with it unforuntately...). All my attempts to connect to WINNT using scripting or wbemtest.exe have results in "Invalid namespace" failures. Any thoughts or comments are appreciated!if ($myDomain = Win32::OLE->GetObject("WinNT://$server/$pworduser")) { $result=$myDomain->ChangePassword($oldpassword, $newpassword); print "Result: $result\n"; } else { print "Couldn't connect :-(\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Win32::OLE Password Change?
by blm (Hermit) on Mar 22, 2003 at 11:53 UTC | |
by jpavel (Sexton) on Mar 24, 2003 at 18:30 UTC |