secman Posted September 11, 2012 Share Posted September 11, 2012 I have a script which has been working sucessfully creating user accounts including creating the home drive on the server using "DirCREATE". We have uprgaded our servers to Virtualised Windows 2008 R2 and now the script fails to create the home drive whilst everything else work (using the wonderful AD tools from Walter).Can anyone offer any assistance?The function to create the folders and sort out the permissions is as follows:- Func Folders($sUser, $sServer);Create Home folderIf FileExists("rmtshare.exe") then DirCreate ("\\" & $sServer & "\HOME\" & $sUser) If FileExists("\\" & $sServer & "\HOME\" & $sUser) Then Global $SHUser = $sUser & "$" Local $ShareCMD ="rmtshare.exe \\" & $sServer & "\" & $SHUser & "=e:\home\" & $sUser & " /UNLIMITED /GRANT everyone:f" Run(@ComSpec & " /c " & $ShareCMD, "", @SW_HIDE) MemoWrite ("User " & $sUser & " - Home Folder Created") Local $xx = '"n:DOMAIN\' & $sUser & ';p:full"' Local $PermCMD = "SetACL.exe -on \\" & $sServer & "\home\" & $sUser & " -ot file -actn ace -ace " & $xx Run(@ComSpec & " /c " & $PermCMD, "", @SW_HIDE) MemoWrite ("User " & $sUser & " - Home Folder Permissions Set") Else MsgBox(4096, "\\" & $sServer & "\HOME\" & $sUser , " Does NOT exist") EndIfElse MsgBox(0, "ERROR", " RMTSHARE.EXE Not Found")EndifEndFunc Thanks Link to comment Share on other sites More sharing options...
rudi Posted September 14, 2012 Share Posted September 14, 2012 What is the output of this one? $sServer="Server123" $sUser="Test99" $DirPath="" & $sServer & "HOME" & $sUser $MyCMD='cmd.exe /k md "' & $DirPath & '" && if %ERRORLEVEL%==0 (echo DIR created: "' & $DirPath & '") else (echo cannot create directory "' & $DirPath & '")' ConsoleWrite($MyCMD & @LF) RunWait($MyCMD,@TempDir,@SW_SHOW) Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now