Solved for my own. Sorry for not well-commented script, hope help to somebody
Creates users according to backed up user directory (process exceptions like Default User, Administrator etc), create home directories for them, migrate backed up user directories.
Const WAIT_ON_RETURN = True
Const HIDE_WINDOW = 0
Const USER_ROOT_UNC = "C:\Users" 'Set Home Folder Location Here
On Error Resume Next
Function CreateUser(strUser, strPass)
Set objShell = CreateObject("Wscript.Shell")
Set objEnv = objShell.Environment("Process")
strComputer = objEnv("COMPUTERNAME")
Set colAccounts = GetObject("WinNT://" & strComputer & ",computer")
Set objUser = colAccounts.Create("user", strUser)
objPasswordNoChangeFlag = objUser.UserFlags XOR ADS_UF_PASSWD_CANT_CHANGE
objUser.Put "userFlags", objPasswordNoChangeFlag
objUser.SetInfo
End Function
Function CreateCatalog(strUser)
Dim WshShell, WshNetwork, objFS, objServer, objShare
Set WshShell = Wscript.CreateObject("Wscript.Shell")
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set objFS = CreateObject("Scripting.FileSystemObject")
Call objFS.CreateFolder(USER_ROOT_UNC & "\" & strUser)
Call WshShell.Run("cacls " & USER_ROOT_UNC & "\" & strUser & " /e /g Administrators:F", HIDE_WINDOW, WAIT_ON_RETURN)
Call WshShell.Run("cacls " & USER_ROOT_UNC & "\" & strUser & " /e /g " & strUser & ":C", HIDE_WINDOW, WAIT_ON_RETURN)
End Function
Function CopyDirs(userName)
arrCopyDirs = Array("Desktop", "Documents", "Downloads", "Links", "Pictures", "Videos", "Music")
Set objFSO = CreateObject("Scripting.FileSystemObject")
For Each dirName in arrCopyDirs
currentDirectory = objFSO.GetAbsolutePathName(".")
copiedDirectory = currentDirectory & "\" & userName & "\" & dirName
destDirectory = USER_ROOT_UNC & "\" & userName & "\" & dirName
objFSO.CopyFolder copiedDirectory, destDirectory
Next
End Function
Function EnumerateCatalog()
Dim objFSO, objFolder
Dim arrNotUsers, arrCopyDirs
arrNotUsers = Array("Default User","MediaAdmin$","Administrator","MSSQL$MICROSOFT##WID","All Users","Plesk Administrator","Default","Public","ServerAdmin$")
Set objFSO = CreateObject("Scripting.FileSystemObject")
For Each objFolder In objFSO.GetFolder(".").SubFolders
If Not Ubound(Filter(arrNotUsers, objFolder.Name)) > -1 Then
Call CreateUser(objFolder.Name, "12345qweasdzxc")
Call CreateCatalog(objFolder.Name)
Call CopyDirs(objFolder.Name)
End If
Next
End Function
Call EnumerateCatalog()