ihotdesk
asked on
Copying NK2 files from TS Profiles to new TS .V2 Profile.
Hi there,
I am wanting to create a script to copy users NK2 file from their old profile to their new one when logged into the new TS server. The old TS server was a 2003 Server (hence old profiles...documents and settings)
The new TS server is a 2008 server, therefore new V2 profile. I have tried using this script:
Dim WshShell : Set WshShell = Wscript.CreateObject("Wscr ipt.Shell" )
Dim fso : Set fso = Wscript.CreateObject("Scri pting.File SystemObje ct")
Dim oNet : Set oNet = Wscript.CreateObject("Wscr ipt.Networ k")
Dim WshEnv : Set WshEnv = WshShell.Environment("Proc ess")
SysDrive = WshEnv("%SystemDrive%")
sFolder = "\\serverdc01\tsprofiles$" & oNet.Username & "\Application Data\Microsoft\Outlook" 'folder to look in
dFolder = SysDrive & "\users\" & oNet.Username & "\appdata\roaming\microsof t\outlook"
IF fso.FolderExists(sFolder) Then
Set oFolder = fso.GetFolder(sFolder)
Set oFiles = oFolder.Files
FOR Each oFile In oFiles
ext = fso.GetExtensionName(oFile )
' check if characters in file extension is "NK2"
IF UCase(ext) = "NK2" Then
Wscript.Echo "NK2 file exists" 'Backup the file NK2 to a server.
Wscript.Echo ext
Set oFolder = fso.CreateFolder(dfolder)
fso.copyfile ofile.path, dfolder
End If
Next
End If
But it doesnt seem to work. I'm not very good at vbscripts so thats probably why! Can anyone advise on this or advise an easy way to do this. They really need the nk2 copied from their old profile location to their new profile. One thing I did notice was that on the old server the profile folders are all username.domainname
e.g. jsoap.example (domain being: example)
Anyone have any helpful tips for me to try? Thanks in advance!
I am wanting to create a script to copy users NK2 file from their old profile to their new one when logged into the new TS server. The old TS server was a 2003 Server (hence old profiles...documents and settings)
The new TS server is a 2008 server, therefore new V2 profile. I have tried using this script:
Dim WshShell : Set WshShell = Wscript.CreateObject("Wscr
Dim fso : Set fso = Wscript.CreateObject("Scri
Dim oNet : Set oNet = Wscript.CreateObject("Wscr
Dim WshEnv : Set WshEnv = WshShell.Environment("Proc
SysDrive = WshEnv("%SystemDrive%")
sFolder = "\\serverdc01\tsprofiles$"
dFolder = SysDrive & "\users\" & oNet.Username & "\appdata\roaming\microsof
IF fso.FolderExists(sFolder) Then
Set oFolder = fso.GetFolder(sFolder)
Set oFiles = oFolder.Files
FOR Each oFile In oFiles
ext = fso.GetExtensionName(oFile
' check if characters in file extension is "NK2"
IF UCase(ext) = "NK2" Then
Wscript.Echo "NK2 file exists" 'Backup the file NK2 to a server.
Wscript.Echo ext
Set oFolder = fso.CreateFolder(dfolder)
fso.copyfile ofile.path, dfolder
End If
Next
End If
But it doesnt seem to work. I'm not very good at vbscripts so thats probably why! Can anyone advise on this or advise an easy way to do this. They really need the nk2 copied from their old profile location to their new profile. One thing I did notice was that on the old server the profile folders are all username.domainname
e.g. jsoap.example (domain being: example)
Anyone have any helpful tips for me to try? Thanks in advance!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
wow, thanks for this. just what i needed as well.
Now lets see if i can modify it to copy the IE favourites folder from old to new...
Jono.
Now lets see if i can modify it to copy the IE favourites folder from old to new...
Jono.
were you able to figure out how to copy favorites?
Whats this bit for?
t oFolder = fso.GetFolder(sFolder)
Set oFiles = oFolder.Files
FOR Each oFile In oFiles
ext = fso.GetExtensionName(oFile
' check if characters in file extension is "NK2"
IF UCase(ext) = "NK2" Then
Wscript.Echo "NK2 file exists" 'Backup the file NK2 to a server.
Wscript.Echo ext
Cant you just go straight ahead and copy the file, as its always called outlook.nk2 anyway?
Also have you checked the users have access to the \\serverdc01\tsprofiles$ share from the new server?