This all works for most users except those that have accounts like:
user.machine
user.Domianname
How can I pull that info??
Set wshNetwork = CreateObject("WScript.Network")
Set fso = CreateObject("Scripting.FileSystemObject")
Set WSHShell = WScript.CreateObject("WScript.Shell")
strUser = WshNetwork.UserName
strDest = "\\server\home\" & strUser
strSource = "C:\Documents and Settings\" & strUser & "\My Documents\*"
On Error Resume Next
RegLocate = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\"
RegLocate2 = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal"
bKey = WSHShell.RegRead (RegLocate2)
wscript.echo
'if bKey = "\\eng-rsbiz\home\%username%" then
' WScript.exit
'End if
'WSHShell.RegDelete RegLocate & "Personal"
'WSHShell.RegDelete RegLocate & "My Pictures"
'WSHShell.RegWrite RegLocate & "Personal", "\\eng-rsbiz\home\%username%", "REG_EXPAND_SZ"
'WSHShell.RegWrite RegLocate & "My Pictures", "\\eng-rsbiz\home\%username%\My Pictures", "REG_EXPAND_SZ"
'fso.CopyFile strSource, strDest
'fso.CopyFolder strSource, strDest
user.machine
user.Domianname
How can I pull that info??
Set wshNetwork = CreateObject("WScript.Network")
Set fso = CreateObject("Scripting.FileSystemObject")
Set WSHShell = WScript.CreateObject("WScript.Shell")
strUser = WshNetwork.UserName
strDest = "\\server\home\" & strUser
strSource = "C:\Documents and Settings\" & strUser & "\My Documents\*"
On Error Resume Next
RegLocate = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\"
RegLocate2 = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal"
bKey = WSHShell.RegRead (RegLocate2)
wscript.echo
'if bKey = "\\eng-rsbiz\home\%username%" then
' WScript.exit
'End if
'WSHShell.RegDelete RegLocate & "Personal"
'WSHShell.RegDelete RegLocate & "My Pictures"
'WSHShell.RegWrite RegLocate & "Personal", "\\eng-rsbiz\home\%username%", "REG_EXPAND_SZ"
'WSHShell.RegWrite RegLocate & "My Pictures", "\\eng-rsbiz\home\%username%\My Pictures", "REG_EXPAND_SZ"
'fso.CopyFile strSource, strDest
'fso.CopyFolder strSource, strDest