Jump to content

Terminal Service Profile function dont work in Windows 7


Recommended Posts

This function to set Terminal Service information that i wrote a few years ago (with water's help), always worked in Windows XP, but no longer seems to work now that we changes over to Windows 7 machines. all other AD functions seem to work fine. could there be something missing in windows 7 like a .dll or something?

Func _AD_SetTSProfile($sAD_User)

 If Not _AD_ObjectExists($sAD_User) Then Return SetError(1, 0, 0)
 Local $ID = $sAD_User
 If StringMid($sAD_User, 3, 1) <> "=" Then $sAD_User = _AD_SamAccountNameToFQDN($sAD_User) ; sAMACccountName provided

 $oAD_User.TerminalServicesProfilePath = "Servertsprofiles" & $ID
 $oAD_User.TerminalServicesHomeDirectory = "Servertshome" & $ID
 $oAD_User.TerminalServicesHomeDrive = "Z:"
 $oAD_User.AllowLogon = True

 $oAD_User.SetInfo()
 If @error <> 0 Then Return SetError(@error, 0, 0)
 Return 1

EndFunc   ;==>_AD_SetTSProfile

-----------------------------------------------------------------------------------------

i ran this small script for the purpose of troubleshooting

#Include <AD.au3>
#Include <lauze.au3>
$sAD_User = "TestUser"

 _AD_Open("","","DC=XXX,DC=XXX","Server.XXX.XXX","CN=Configuration,DC=XXX,DC=XXX")
 $result = _AD_SetTSProfile($sAD_User)
 ConsoleWrite("   " & $result & "  - " &  @error & "  -  ")
 _AD_Close()

 

----------------------------------------------------------

results:

>Running:(3.3.8.1):C:Program Files (x86)AutoIt3autoit3.exe "P:DocumentsAuto Ittestts_win7.au3"   
--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
   0  - -2147352570  -  +>14:02:37 AutoIt3.exe ended.rc:0
>Exit code: 0    Time: 0.820
 

Edited by paullauze
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...