Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Terminal Service Profile function dont work in Windows 7

$
0
0

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 = "\\Server\tsprofiles\" & $ID
 $oAD_User.TerminalServicesHomeDirectory = "\\Server\tshome\" & $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)\AutoIt3\autoit3.exe "P:\Documents\Auto It\test\ts_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
 


Viewing all articles
Browse latest Browse all 12506

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>