/bundles/itninjaweb/img/Breadcrumb_cap_w.png
Ok so here's what I need to do,

I need to copy a shortcut from all users, start menu, programs, general applications folder to current user, start menu, programs, general applications folder, when I run my script I get a permission denied error, code 800A0046. What's wrong with my script folks? Below is the script in question

Script

Dim strAllUsersPgm
Dim strTeammateCitrixSSO
Dim strFile

set wshShell = createobject("Wscript.Shell")
Set wshFileSys = CreateObject("Scripting.FileSystemObject")

strAllUsersPgm = wshShell.ExpandEnvironmentStrings("%ALLUSERSPROFILE%") & "\Start Menu\Programs\General Applications"

strTeamMateCitrixSSO = wshShell.ExpandEnvironmentStrings("%USERPROFILE%") & "\Start Menu\Programs\General Applications"

strFile = strAllUsersPgm & "\Teammate Citrix SSO.lnk"

If wshFileSys.FileExists(strFile) Then

wshFileSys.CopyFile strFile, strTeamMate, True
End If
0 Comments   [ - ] Hide Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity

Answers

0
Use this. This line edited from :

wshFileSys.CopyFile strFile, strTeamMate, True

To:

wshFileSys.CopyFile strFile, strTeamMate & "\"

------------------------------------------------------------

Dim strAllUsersPgm
Dim strTeammateCitrixSSO
Dim strFile
set wshShell = createobject("Wscript.Shell")
Set wshFileSys = CreateObject("Scripting.FileSystemObject")
strAllUsersPgm = wshShell.ExpandEnvironmentStrings("%ALLUSERSPROFILE%") & "\Start Menu\Programs\General Applications"
strTeamMateCitrixSSO = wshShell.ExpandEnvironmentStrings("%USERPROFILE%") & "\Start Menu\Programs\General Applications"
strFile = strAllUsersPgm & "\Teammate Citrix SSO.lnk"
If wshFileSys.FileExists(strFile) Then
IF NOT wshFileSys.FolderExists(strTeamMateCitrixSSO) Then
wshFileSys.CreateFolder(strTeamMateCitrixSSO)
End if
wshFileSys.CopyFile strFile, strTeamMateCitrixSSO & "\"
End If
Answered 11/02/2010 by: murali.bhat
Purple Belt

Please log in to comment
0
Thanks, seems to work a treat!
Answered 11/02/2010 by: cowley
Orange Belt

Please log in to comment
0
I'd recommend restoring the 'True' argument, so that an existing file gets forcibly overwritten.

I'd also recommend adding some error-trapping. Too many scripts assume that everything will always work whereas good scripts always assume exactly the opposite.
Answered 11/02/2010 by: VBScab
Red Belt

Please log in to comment