Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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.


In reply to Re: Update HomeDirectory Using Win32::Ole by ikegami
in thread Update HomeDirectory Using Win32::Ole by Anonymous Monk

Title:
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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2024-04-24 14:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found