Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://904685]
Approved by chrestomanci
Front-paged by toolic
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2022-09-29 15:19 GMT
Find Nodes?
    Voting Booth?
    I prefer my indexes to start at:

    Results (125 votes). Check out past polls.