Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Update HomeDirectory Using Win32::Ole

by ikegami (Patriarch)
on Jun 07, 2005 at 01:01 UTC ( [id://464119]=note: print w/replies, xml ) Need Help??


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
    HomeDirectory is proably a property, not a method, so
    $User->HomeDirectory("\\server\homeshare");
    should be
    $User->{HomeDirectory} = "\\\\server\\homeshare";
    Win32::OLE uses a lot of AUTOLOAD magic, so both might be exchangeable. Well, at least, I do think the accessor version of the property without parameters, is equivalent to just reading the property:
    $home = $User->HomeDirectory();
    vs.
    $home = $User->{HomeDirectory};

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://464119]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2024-03-29 11:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found