Help removing icon from quick launch
Greetings,
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?
Thanks...
=========== CURRENT BATCH FILE =============
copy outlook.lnk "%appdata%\microsoft\internet explorer\quick launch\*.*"
cd %appdata%\microsoft\internet explorer\quick launch
del "lotus notes.lnk"
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?
Thanks...
=========== 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
Answers (6)
Please log in to answer
Posted by:
Garrett
19 years ago
I trimmed this from another script I had laying around. Be sure to read the comments in the Main() function.
scriptVer = "1.0.0.0"
'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)
Wscript.Quit
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
DisplayInfo
'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
else
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 & "'")
Else
Log("Searching: '" & objSubfolder.path & "'")
DeleteTheLink(objSubfolder.path)
End If
Next
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
Posted by:
Garrett
19 years ago
Posted by:
bsieloff
19 years ago
Posted by:
WiseUser
19 years ago
Posted by:
Garrett
19 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.