G
Guest
Hi,
What is wrong with this script. Please help. I'm trying to copy an icon to
everyone's desktop and some desktops are redirected to a U: drive and others
aren't, so I'm trying to account for different locations. I'm getting a
'path not found' even though i've checked and double checked. Can anyone see
anything that is blatently wrong?
Dim objFSO, oshell, objFileCopy, sUserProfile, sUserprofile2, oProcessEnv
Set oshell = CreateObject("WScript.Shell")
Set oProcessEnv = oShell.Environment("PROCESS")
sSessionName = oProcessEnv("SESSIONNAME")
If sSessionName = "" Or LCase(sSessionName) = "console" Then
Set objFSO = CreateObject("Scripting.FileSystemObject")
systemroot = oshell.ExpandEnvironmentStrings("%SYSTEMROOT%\")
Set objFileCopy = objFSO.GetFile("\\schfs02\deployment center\scm\webica.ini")
objFileCopy.copy systemroot
sUserProfile = oShell.ExpandEnvironmentStrings("%USERPROFILE%\desktop\")
suserprofile2 = oShell.ExpandEnvironmentStrings("U:\desktop\")
Set objFileCopy = objFSO.GetFile("\\schfs02\deployment center\scm\scm.lnk")
If objfso.folderexists("%USERPROFILE%\desktop\") = TRUE then
objFileCopy.Copy sUserProfile
Else
objFileCopy.Copy suserprofile2
End IF
End IF
What is wrong with this script. Please help. I'm trying to copy an icon to
everyone's desktop and some desktops are redirected to a U: drive and others
aren't, so I'm trying to account for different locations. I'm getting a
'path not found' even though i've checked and double checked. Can anyone see
anything that is blatently wrong?
Dim objFSO, oshell, objFileCopy, sUserProfile, sUserprofile2, oProcessEnv
Set oshell = CreateObject("WScript.Shell")
Set oProcessEnv = oShell.Environment("PROCESS")
sSessionName = oProcessEnv("SESSIONNAME")
If sSessionName = "" Or LCase(sSessionName) = "console" Then
Set objFSO = CreateObject("Scripting.FileSystemObject")
systemroot = oshell.ExpandEnvironmentStrings("%SYSTEMROOT%\")
Set objFileCopy = objFSO.GetFile("\\schfs02\deployment center\scm\webica.ini")
objFileCopy.copy systemroot
sUserProfile = oShell.ExpandEnvironmentStrings("%USERPROFILE%\desktop\")
suserprofile2 = oShell.ExpandEnvironmentStrings("U:\desktop\")
Set objFileCopy = objFSO.GetFile("\\schfs02\deployment center\scm\scm.lnk")
If objfso.folderexists("%USERPROFILE%\desktop\") = TRUE then
objFileCopy.Copy sUserProfile
Else
objFileCopy.Copy suserprofile2
End IF
End IF