Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

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

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"

Replies are listed 'Best First'.
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 (Scribe) 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. ;-)


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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://904685]
Approved by chrestomanci
Front-paged by toolic
[ozboomer]: Howdy, all.. Trying this once more... Not really a perl question :(... but I don't know how to even title my query (more...)
[ozboomer]: There's a text file with lots of sections in it, like an '.ini/.conf' file. Each section can be 'used' or 'unused' by its application (more...)
[ozboomer]: Some folk want to use the text file as 'storage', keeping ALL items in it (a database); others call it an 'active document' that should only contain 'in-use' sections. Is there a 'good practice' for this sort of thing?

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2018-05-21 00:23 GMT
Find Nodes?
    Voting Booth?