Here is a script I used to change the Terminal Services Profile Path of
a user.

 

I ran this on Windows XP SP2 against a Windows 2000 domain controller.

 

I didn't find many examples of how to do this, and most of my searches
for perl or vbscript solutions turned up pages saying it can only be
done on Windows 2003. For those of you like me still stuck with 2000,
maybe this will save you some time...

 

use strict;

use Carp;

use Win32::OLE;

 

my $objRootDSE = Win32::OLE->GetObject("LDAP://RootDSE")

            or die Win32::OLE->LastError();

my $strDefaultNC = $objRootDSE->Get("defaultnamingcontext")

            or die Win32::OLE->LastError();

 

my $strUsersOUADsPath = "LDAP://OU=LHL Users";

my $objUsersOU = Win32::OLE->GetObject(

                        "$strUsersOUADsPath,$strDefaultNC"

            ) or die Win32::OLE->LastError();

 

 

my $objUser = Win32::OLE->GetObject(

            "LDAP://CN=testuser,OU=Users,DC=company,DC=co,DC=nz"

);

 

 

print "path = " . $objUser->TerminalServicesProfilePath() . "\n";

 

$objUser->{TerminalServicesProfilePath} = "\\\\aaa\\sss";

confess "Error: " . Win32::OLE->LastError() if(Win32::OLE->LastError());

$objUser->SetInfo();

confess "Error: " . Win32::OLE->LastError() if(Win32::OLE->LastError());


Attention:
The information contained in this message and or attachments is intended only 
for the
person or entity to which it is addressed and may contain confidential and/or 
privileged
material. Any review, retransmission, dissemination or other user of this 
information, or 
taking of any action in reliance upon this information by persons or entities 
other than the
intended recipient is prohibited. If you received this in error, please contact 
the sender
and delete the material from any system and destroy any copies.
Lakes District Health and any of its subsidiaries reserve the right to monitor 
all
e-mail communication through its networks.

#####################################################################################
This e-mail message has been scanned for Viruses and Content and cleared 
by NetIQ MailMarshal
#####################################################################################

Reply via email to