in reply to Update HomeDirectory Using Win32::Ole
A found a few problems.
According to you VB snippet, ",user" is appended to the first string; it's not a seperate argument.
Win32::OLE->GetObject("WinNT://wsi/$username", "user");
should be
Win32::OLE->GetObject("WinNT://wsi/$username,user");
Don't forget to double backslashes in hard-coded strings.
"\\server\homeshare"
should be
"\\\\server\\homeshare"
HomeDirectory is proably a property, not a method, so
$User->HomeDirectory("\\server\homeshare");
should be
$User->{HomeDirectory} = "\\\\server\\homeshare";
Unfortunately, that doesn't seem to be enough.
use strict; use warnings; use Win32::OLE (); my $user_name = 'Administrator'; my $user = Win32::OLE->GetObject("WinNT://wsi/$user_name,user") or die("\$user is undef\n"); # <---- dies here print($User->{HomeDirectory}, "\n"); # $user->{HomeDirectory} = "\\\\server\\homeshare"; # $user->SetInfo;
But that's probably cause I'm not running a compatible platform. MSDN says this interface is only available on Windows 2000 Server and Windows Server 2003, which I don't have.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Update HomeDirectory Using Win32::Ole
by bart (Canon) on Jun 07, 2005 at 05:16 UTC |