First of all, hello, & thanks for all of the helpful tips I've pick up here so far.
What I am trying to do is copy a folder (with all files & sub-directories) from the root of C:, to the currently logged in user's "my documents".
What I've found so far is a script that will copy a folder/file to ALL user profiles "my docs", with some exceptions. I can't seem to find the code I need to simply do this for the currently logged in user.
Here is that script;
Dim fso
Dim oFolder1, objFolder, oFolder
Dim path
Dim WSHShell
Dim colFolders
Dim sDocsAndSettings
Dim strComputer
strComputer = "."
Set WSHShell = CreateObject("WScript.Shell")
Set fso = createobject("Scripting.FileSystemObject")
'SPECIFY THE PATH OF THE FOLDER IN WHICH SOURCE FILES RESIDE
Set oFolder1 = fso.GetFolder("c:\Template")
'COPY FILES TO USER PROFILES
sDocsAndSettings = "C:\Documents and Settings"
Set colFolders = fso.GetFolder(sDocsAndSettings)
For Each oFolder In colFolders.SubFolders
Select Case LCase(oFolder.Name)
Case "admin", "administrator", "newuser", "all users", "default user.original", "localservice", "networkservice"
'LEAVE THE DEFAULT PROFILES ON THE MACHINE
Case Else
' Check for the path
If fso.FolderExists(sDocsAndSettings & oFolder.Name & "\Application Data") Then
'COPY FOLDER TO USER PROFILE
fso.CopyFolder oFolder1, sDocsAndSettings & oFolder.Name & "\Application Data\Microsoft\Templates" ,True
End If
End Select
Next
Set fso = Nothing
Set WSHShell = Nothing
I want this to be a locally run script that is invoked by the user.
Any help would be awesome. Thanks!
What I am trying to do is copy a folder (with all files & sub-directories) from the root of C:, to the currently logged in user's "my documents".
What I've found so far is a script that will copy a folder/file to ALL user profiles "my docs", with some exceptions. I can't seem to find the code I need to simply do this for the currently logged in user.
Here is that script;
Dim fso
Dim oFolder1, objFolder, oFolder
Dim path
Dim WSHShell
Dim colFolders
Dim sDocsAndSettings
Dim strComputer
strComputer = "."
Set WSHShell = CreateObject("WScript.Shell")
Set fso = createobject("Scripting.FileSystemObject")
'SPECIFY THE PATH OF THE FOLDER IN WHICH SOURCE FILES RESIDE
Set oFolder1 = fso.GetFolder("c:\Template")
'COPY FILES TO USER PROFILES
sDocsAndSettings = "C:\Documents and Settings"
Set colFolders = fso.GetFolder(sDocsAndSettings)
For Each oFolder In colFolders.SubFolders
Select Case LCase(oFolder.Name)
Case "admin", "administrator", "newuser", "all users", "default user.original", "localservice", "networkservice"
'LEAVE THE DEFAULT PROFILES ON THE MACHINE
Case Else
' Check for the path
If fso.FolderExists(sDocsAndSettings & oFolder.Name & "\Application Data") Then
'COPY FOLDER TO USER PROFILE
fso.CopyFolder oFolder1, sDocsAndSettings & oFolder.Name & "\Application Data\Microsoft\Templates" ,True
End If
End Select
Next
Set fso = Nothing
Set WSHShell = Nothing
I want this to be a locally run script that is invoked by the user.
Any help would be awesome. Thanks!