On our network we are redirecting some things but not all folders. Users always start yelling about I am missing my favorites or when I type in Outlook I do not get the "names" to popup. So the script below will copy these important files to a backup location. I made everything modular because this script does some good things. 1. It will detect who the currently logged on user is. 2. It performs a file copy using the %userprofile% variable. 3. Lastly, it checks to see if a folder exists. (I know this one is not that exciting)
----------COPY EVERYTHING BELOW THIS LINE---------- 'This script will copy the users favorites folder and the N2K file to a file server. 'Created 12.20.06 By Cheyenne Harden
'Subs and Functions Sub CopyFavorites Set objShell = CreateObject("Wscript.Shell") strProfile = objShell.ExpandEnvironmentStrings("%userprofile%") 'Wscript.Echo strProfile Set objFSO = CreateObject("Scripting.FileSystemObject") objFSO.CopyFolder strProfile & strFavorites, strDestFolder3 , OverWriteFiles End Sub
Sub CopyNK2() Set objShell = CreateObject("Wscript.Shell") strProfile = objShell.ExpandEnvironmentStrings("%userprofile%") 'Wscript.Echo strProfile Set objFSO = CreateObject("Scripting.FileSystemObject") objFSO.CopyFile strProfile & strLocalFolder & "*.nk2" , strDestFolder2 , OverwriteExisting End Sub
Function FolderCheck() Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(strDestFolder & strUserName & "\" & "Backup") Then 'WScript.Echo "Folder does exist." 'WScript.Echo strDestFolder & strUserName & "\" & "Backup" strDestFolder2 = strDestFolder & strUserName & "\" & "Backup" Else Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFolder = objFSO.CreateFolder(strDestFolder & "\" & strUserName & "\" & "Backup") strDestFolder2 = strDestFolder & strUserName & "\" & "Backup" End If End Function
Function UserCheck() Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colComputer = objWMIService.ExecQuery _ ("Select * from Win32_ComputerSystem") For Each objComputer in colComputer 'Wscript.Echo objComputer.UserName strUserName = Replace(objComputer.UserName, "YOUR_DOMAIN_HERE\", strReplace) 'Wscript.Echo strUserName Next End Function
Function FolderCheck2() Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(strDestFolder & strUserName & "\" & "Backup\Favorites") Then 'WScript.Echo "Folder does exist." 'WScript.Echo strDestFolder & strUserName & "\" & "Backup" strDestFolder3 = strDestFolder & strUserName & "\" & "Backup\Favorites" Else Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFolder = objFSO.CreateFolder(strDestFolder & "\" & strUserName & "\" & "Backup\Favorites") strDestFolder3 = strDestFolder & strUserName & "\" & "Backup\Favorites" End If End Function
Function ProfileCheck() Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(strDestFolder & strUserName) Then 'WScript.Echo "Folder does exist." 'WScript.Echo strDestFolder & strUserName & "\" & "Backup" Else Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFolder = objFSO.CreateFolder(strDestFolder & "\" & strUserName) 'strDestFolder2 = strDestFolder & strUserName & "\" & "Backup" End If End Function
----------COPY EVERYTHING ABOVE THIS LINE----------
PLEASE MAKE SURE NO WORD WRAPPING IS HAPPENING IN YOUR SCRIPT!!!
To make this script work you will need one things!
1. Run this as a LogOff script. 2. Make sure the user has write access to the destination folder. 3. Set the destination folder Here: strDestFolder = "\\FILE_SERVER_NAME_HERE\PATH_HERE\" 4. Set your Domain Here: strUserName = Replace(objComputer.UserName, "YOUR_DOMAIN_HERE\", strReplace)
This information is provided "AS IS" with no warranties expressed or implied.
In a recent study, shoppers were asked to taste a chocolate-chip cookie.
When given a cookie from a full jar, they said it tasted all right;
but when they were offered one from a nearly empty jar, they said it tasted better.
This shows an interesting aspect of human nature. The scarcer something is,
the more highly people tend to value it.
aoc gold
lotro gold
Guild Wars Gold
second life
SilkRoad
EverQuest 2
WOW 60 Tage Game Time Card
Eve Online gold
wow TBC
wow The Burning Crusade CD Key
wow cdkey
Lord of the Ring gold
When you feel hurt and your tears are gonna to drop.
Please look up and have a look at the sky once belong to us.
If the sky is still vast,clouds are still clear,
you shall not cry because my leave doesn't takeaway the world that belongs to you.
age of conan gold
[url=http://www.thepowerlevel.com/Gold.php? N=Runescape]runescap
e gold[/url]
[url=http://www.thepowerlevel.com/Gold.php? N=MapleStory]maplest
ory mesos[/url]
[url=http://www.thepowerlevel.com/Gold.php? N=Warhammer]warhamme
r gold[/url] silkroad gold
Do you fear thewow gold force of the wind The slash of the rain? Go facewow goldthem and fight them,
Be savage again
Go hungry and cold like the wolf
Go wadewow goldlike the crane
The palms of your hands will thicken
The skin of wow goldyour cheeks will tan
You
As we know, wow gold guide,buying wow gold and on our website.wow gold guide We have available stock of gold on most of the servers, so that we can do a really instant way of delivery There is Free WoW Gold no doubt that one of the reasons players are entranced with the RPG genre,Free WoW Gold is to see their characters grow in power and strength. Tibet Tour
World of Warcraft is a magic sword and the world, is also a Master WAR3 natural world is an important component. In order to enhance the strength of the Master, players often through buy wow gold to increase the Master of the equipment and skills. Master and improve the equipment and skills. Mmoinn.com is a special sale wow gold a good place. The players need to wow power leveling and we can provide. As soon as possible to buy it!
[url=http://www.thepowerlevel.com/Gold.php? N=Warhammer]warhamme
r gold[/url]
[url=http://www.thepowerlevel.com/Gold.php? N=Warhammer]warhamme
r online gold[/url]
[url=http://www.thepowerlevel.com/Powerleveling.php? N=Warhammer]warhamme
r power leveling[/url]