Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Setting Terminal Server User Profile Settings

by ToolHack (Novice)
on May 13, 2011 at 15:06 UTC ( #904685=perlquestion: print w/ replies, xml ) Need Help??
ToolHack has asked for the wisdom of the Perl Monks concerning the following question:

I need help setting some Terminal Server user profile settings on a 2008 Server machine. In particular, I want to uncheck the "Connect client drives at logon" checkbox. If I were a Windows hacker (which I admit, I'm not), I would apparently have to use the IADsTSUserEx interface described here http://msdn.microsoft.com/en-us/library/aa380823(VS.85).aspx

I don't understand how to do that with Perl.

What I was trying and failing with was:

$user->SetProperty('msTSConnectClientDrives', 0); $user->SetInfo();

where $user is a Win32::OLE object I created in Active Directory through LDAP.

I get the error:

Win32::OLE(0.1709) error 0x8007200b: "The attribute syntax specified to the directory service is invalid"

Comment on Setting Terminal Server User Profile Settings
Download Code
Re: Setting Terminal Server User Profile Settings
by Anonymous Monk on May 13, 2011 at 17:41 UTC
      Thanks for the links. I've read most of them.

      I'm not sure what alternate forms of SetProperty means. There is a form that takes @ARGS as a parameter before the value you want to set, but I have no idea what that is for.

      I have tried setting different values:
      SetProperty("msTSConnectClientDrives", 0); SetProperty("msTSConnectClientDrives", 'No'); SetProperty("msTSConnectClientDrives", 'False'); SetProperty("msTSConnectClientDrives", Variant(VT_BOOL,0));
      Only the last one does not give an error, but it also doesn't change the check box.

      I have been able to set other TS properties. For example, TerminalServicesHomeDirectory. None of the ones that start with msTS* work though. Maybe there is a different name I should be using?

        I'm not sure what alternate forms of SetProperty means.

        Well, if you read Win32::OLE SetProperty documentation it discusses masking, so if the object you're working with has a SetProperty method, it will conflict with Win32::OLE's method, so you have to use $obj->Invoke('SetProperty', @args )

Re: Setting Terminal Server User Profile Settings
by natxo (Sexton) on May 15, 2011 at 20:07 UTC
      I'd rather not depend on a 3rd party tool for this. I'll see if Lanman can do the job. Notice I don't consider Perl as 3rd party. ;-)

      Thanks.

        Doesn't look like Lanman is supported on Perl 5.10...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://904685]
Approved by chrestomanci
Front-paged by toolic
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (9)
As of 2014-12-21 20:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (107 votes), past polls