I am trying to remove a lotus notes icon and replace it with a MS outlook icon in the quick launch bar. I will be packaging the command and sending it out through SMS. My issue is that our users do not have rights to their local C: drive, therefore the SMS package will be executed by the local system account which has rights to manipulate files on the C: drive.

Below is my .BAT file but it does not work, probably since the the machine does not know how to get to the current logged on users %appdata% folder. Any suggestions on how to accomplish this?


=========== CURRENT BATCH FILE =============

copy outlook.lnk "%appdata%\microsoft\internet explorer\quick launch\*.*"

cd %appdata%\microsoft\internet explorer\quick launch

del "lotus notes.lnk"
0 Comments   [ + ] Show comments


Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

All Answers

Can you roll out the "Remove Notes Icon" portion of the package by logon script? Since users have rights to thier "C:\Documents and Settings\<USERNAME>\Application Data\Microsoft\Internet Explorer\Quick Launch" your logon script can do the cleanup for ya.
Answered 08/11/2005 by: Garrett
Orange Belt

I won't be able to do this by login script... too much politics! Is there a way I could scan all of "Documents and Settings" for the "lotus Notes.lnk" file and delete it?
Answered 08/15/2005 by: bsieloff
Senior Yellow Belt

I trimmed this from another script I had laying around. Be sure to read the comments in the Main() function.

scriptVer = ""

'Checks to make sure the script is running in cscript
If Lcase(Right(Wscript.FullName, 12)) = "\wscript.exe" Then
CreateObject("Wscript.Shell").Run "cscript.exe " & Chr(34) & Wscript.ScriptFullName & Chr(34)
End If

Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8

strScriptPath = Wscript.ScriptFullName
strScriptName = Wscript.ScriptName
strCurPath = Left(strScriptPath, Len(strScriptPath) - Len(strScriptName))
If Right(strCurPath,1)<>"\" Then strCurPath = strCurPath & "\"

Set objShell = Wscript.CreateObject("Wscript.Shell")
'Set objExplorer = CreateObject("InternetExplorer.Application")
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Set objNetwork = Wscript.CreateObject("Wscript.Network")

'Displays Info on the script and host

'Uncomment to have the script pause at the start
'wscript.stdout.writeline "This will run on all user folders. Do not continue if you are not positively positive you want to do this."
'wscript.stdout.writeline "Press enter to run the script."
'continue = lCase(wscript.stdin.readline)

Main("C:\Documents and Settings")

'Uncomment to have the script pause at the end
'wscript.stdout.writeline "All done! Press Enter to continue."
'continue = lCase(wscript.stdin.readline)
'End of main code body

sub DisplayInfo
wscript.stdout.writeline ""
wscript.stdout.writeline wscript.application & " Build: " & wscript.buildversion
wscript.stdout.writeline wscript.ScriptName & " Build: " & scriptVer
wscript.stdout.writeline "Working Directory " & strCurPath
wscript.stdout.writeline ""
end sub

Sub Log(message)
if len(message) > 65 then
strWrapped = right(message,len(message) - 65)
newmessage = left(message, 65) & VbCrLf & vbTab & strWrapped
newmessage = message
end if
wscript.stdout.writeline newMessage
End Sub

Sub Main(ByVal strDirectory) '"C:\Documents and Settings"
' 1) Enumerate all users in documents and settings
Set objFolder = objFSO.GetFolder(strDirectory)
Set colSubFolders = objFolder.Subfolders
For Each objSubfolder in colSubfolders
If instr(1, objSubfolder.name,"Default", vbTextCompare) Or _
instr(1, objSubfolder.name,"LocalService", vbTextCompare) Or _
instr(1, objSubfolder.name,"NetworkService", vbTextCompare) Then
'You can skip accounts that have not logged on interactively
'instr(1, objSubfolder.name,"LocalAccount1", vbTextCompare) Or _
'instr(1, objSubfolder.name,"SMSAccount1", vbTextCompare) Or _
Log("Skipping: '" & objSubfolder.name & "'")
Log("Searching: '" & objSubfolder.path & "'")
End If
End Sub

Sub DeleteTheLink(ByVal strDirectory)
If objFSO.FolderExists(strDirectory & "\Application Data\Microsoft\Internet Explorer\Quick Launch") Then
if objFSO.FileExists(strDirectory & "\Application Data\Microsoft\Internet Explorer\Quick Launch\Notes.lnk") then
objFSO.DeleteFile(strDirectory & "\Application Data\Microsoft\Internet Explorer\Quick Launch\Notes.lnk")
Log("Deleting: '" & strDirectory & "\Application Data\Microsoft\Internet Explorer\Quick Launch\Notes.lnk")
end if
End If
End Sub
Answered 08/16/2005 by: Garrett
Orange Belt


Simply AWSOME!

Thanks a million.

Answered 08/22/2005 by: bsieloff
Senior Yellow Belt

ORIGINAL: bsieloff


Simply AWSOME!

Thanks a million.


Yet you haven't rated his post??[;)]
Answered 08/23/2005 by: WiseUser
Fourth Degree Brown Belt

You’re welcome Bob.

The original script is quite a bit larger, I had to convert any shortcuts referencing 'G:' to reference 'S:\<Their Site>\Shared'. It only took me a couple minutes to trim this section out for you.

Answered 08/23/2005 by: Garrett
Orange Belt