Hi, I have a script that seems to work fine but I have a particular problem.
On our workstations, user profiles are in the form username.domainname
eg for Michael Smith;
smith_m.mydomain
So this would be the name of the folder that appears under c:\documents and settings\smith_m.mydomain\my documents
How can I modify this script to reflect that?
---------------
Option Explicit
Dim objFSO, objWSH, strMyDocs, strUserName
Set objFSO = Wscript.CreateObject("Scripting.FileSystemObject")
Set objWSH = Wscript.CreateObject("WScript.Shell")
strUserName = objWSH.ExpandEnvironmentStrings("%username%")
If strUserName = "" Then
WScript.Echo("Unable to get %username%")
WScript.Quit 1
End if
strMyDocs = ("c:\documents and settings\%username%\MyDocuments")
If (objFSO.FolderExists(strMyDocs)) Then
objFSO.CopyFolder strMyDocs, "\\backup server\user folders\" & strUserName & "\My Documents"
Else
WScript.Echo("Unable to locate folder")
WScript.Quit 1
End if
Set objFSO = Nothing
Wscript.Quit 0
------------------------------
TIA
On our workstations, user profiles are in the form username.domainname
eg for Michael Smith;
smith_m.mydomain
So this would be the name of the folder that appears under c:\documents and settings\smith_m.mydomain\my documents
How can I modify this script to reflect that?
---------------
Option Explicit
Dim objFSO, objWSH, strMyDocs, strUserName
Set objFSO = Wscript.CreateObject("Scripting.FileSystemObject")
Set objWSH = Wscript.CreateObject("WScript.Shell")
strUserName = objWSH.ExpandEnvironmentStrings("%username%")
If strUserName = "" Then
WScript.Echo("Unable to get %username%")
WScript.Quit 1
End if
strMyDocs = ("c:\documents and settings\%username%\MyDocuments")
If (objFSO.FolderExists(strMyDocs)) Then
objFSO.CopyFolder strMyDocs, "\\backup server\user folders\" & strUserName & "\My Documents"
Else
WScript.Echo("Unable to locate folder")
WScript.Quit 1
End if
Set objFSO = Nothing
Wscript.Quit 0
------------------------------
TIA