Link to home
Start Free TrialLog in
Avatar of SP3CLt
SP3CLtFlag for United States of America

asked on

Desktop/Start Menu Shortcut Addition/Removal Scripts

Hello EE,

I'm short on time, and need an assit in configuring scripts to deploy a new desktop and start menu short cut, as well as remove a start menu shortcut & favorites shortcut, along with a desktop shortcut (within a desktop folder).

Here are the parameters in question for these scripts:

Phase 1 / Job 1
1) Shortcut to add to %all users% desktop: "ADP Portal" (https://portal.adp.com)
2) Shortcut to add into %all users% desktop (folder) named "Corporate Shortcuts": "ADP Portal" (https://portal.adp.com)
3) Shortcut to add to %all users% start menu (C:\Documents and Settings\All Users\Start Menu\CSA\) : "ADP Portal" (https://portal.adp.com)
4) Shortcut to add to all users favorites (C:\Documents and Settings\All Users\Favorites\): "ADP Portal" (https://portal.adp.com)


Phase 2 / Job 2 (to be execute the following day)

1) REMOVE/DELETE the following shortcuts from within the %all users% desktop (folder) named "Corporate Shortcuts": "iPAY-adp" AND/OR "ADP-iPAY" (https://ipay.adp.com), "ezLabor"  AND/OR "ADP ezLabor" (http://workforceportal.elabor.com/) and "HRB" (https://home.eease.com/login/)

2) REMOVE/DELETE the following shortcuts from the %all users% startmenu (C:\Documents and Settings\All Users\Start Menu\CSA\) : "ADP ezLabor" AND "ADP-iPAY"

3) REMOVE/DELETE the following shortcuts from the %all users% favorites folder (C:\Documents and Settings\All Users\Favorites\) : "iPAY-adp" AND/OR "ADP-iPAY" (https://ipay.adp.com), "ezLabor"  AND/OR "ADP ezLabor" (http://workforceportal.elabor.com/) and "HRB" (https://home.eease.com/login/).


Requesting guidance and validation on what I have working thus far within the code snippets.
Thank you s much in advanced!


Hello EE,

I'm short on time, and need an assit in configuring scripts to deploy a new desktop and start menu short cut, as well as remove a start menu shortcut & favorites shortcut, along with a desktop shortcut (within a desktop folder).

Here are the parameters in question for these scripts:

Phase 1 / Job 1
1) Shortcut to add to %all users% desktop: "ADP Portal" (https://portal.adp.com)
2) Shortcut to add into %all users% desktop (folder) named "Corporate Shortcuts": "ADP Portal" (https://portal.adp.com)
3) Shortcut to add to %all users% start menu (C:\Documents and Settings\All Users\Start Menu\CSA\) : "ADP Portal" (https://portal.adp.com)
4) Shortcut to add to all users favorites (C:\Documents and Settings\All Users\Favorites\): "ADP Portal" (https://portal.adp.com)


Phase 2 / Job 2 (to be execute the following day)

1) REMOVE/DELETE the following shortcuts from within the %all users% desktop (folder) named "Corporate Shortcuts": "iPAY-adp" AND/OR "ADP-iPAY" (https://ipay.adp.com), "ezLabor"  AND/OR "ADP ezLabor" (http://workforceportal.elabor.com/) and "HRB" (https://home.eease.com/login/)

2) REMOVE/DELETE the following shortcuts from the %all users% startmenu (C:\Documents and Settings\All Users\Start Menu\CSA\) : "ADP ezLabor" AND "ADP-iPAY"

3) REMOVE/DELETE the following shortcuts from the %all users% favorites folder (C:\Documents and Settings\All Users\Favorites\) : "iPAY-adp" AND/OR "ADP-iPAY" (https://ipay.adp.com), "ezLabor"  AND/OR "ADP ezLabor" (http://workforceportal.elabor.com/) and "HRB" (https://home.eease.com/login/).


Requesting guidance and validation on what I have working thus far within the code snippets.
Thank you s much in advanced!


Code Snippet:
 What I will be using thus far:

1) Copy the new icon over to the local machine(s)(BATCH):

xcopy "\\network path\adpportal.ico" "%systemroot%\icons" /C /H /R /Y

2) Place desktop shortcut (VBS):

'CreateSC.vbs
Dim objShell:Set objShell=CreateObject("Wscript.Shell")
strLogonServer = objShell.ExpandEnvironmentStrings("%LOGONSERVER%")
strAllUsersDesktop = objShell.ExpandEnvironmentStrings("%ALLUSERSPROFILE%") & "\Desktop\"
Dim objSC: Set objSC=objShell.CreateShortCut(strAllUsersDesktop & "\ADP Portal.lnk")
With objSC
  .WorkingDirectory="https://portal.adp.com" (?)
  .TargetPath="http:"https://portal.adp.com" (?)
  .IconLocation =""%systemroot%\icons\adpportal.ico"
  .Save
End With
Set objSC=Nothing
Set objShell=Nothing


3) To add the startmenu shortcut?? (VBS):
Const ADMINISTRATIVE_TOOLS = 6

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(CSA)
Set objFolderItem = objFolder.Self    

Set objShell = WScript.CreateObject("WScript.Shell")
strDesktopFld = objFolderItem.Path
Set objURLShortcut = objShell.CreateShortcut(strDesktopFld & "\Example.url")
objURLShortcut.TargetPath = "http://www.example.com"
objURLShortcut.Save

OR SHOULD IT BE (Batch):

xcopy "\\C:\Documents and Settings\All Users\Desktop\(newlink from above).lnk" "C:\Documents and Settings\All Users\Start Menu\CSA" /C /H /R /Y

(Same for the allusers favorites folder below?)

xcopy "\\C:\Documents and Settings\All Users\Desktop\(newlink from above).lnk" "C:\Documents and Settings\All Users\favorites" /C /H /R /Y


For the Removal Process, remove shortcuts/icons from the "Corporate Shortcuts" desktop folder (all users) on the local machine(s)(BATCH)::

@echo off
setlocal
 
set files="iPAY-adp.lnk" "ADP-iPAY.lnk" "ADP-iPAY.lnk" "ezLabor.lnk" "ADP ezLabor.lnk" "HRB.lnk"
for %%G in (%files%) do del /f /s /q "%allusersprofile%\..\%%~G" (*How do I configure this to run within the desktop\corporate shortcuts folder?)
 
exit



TO REMOVE OLD <ALL> SHORTCUTS?:

(for the desktop "corporate shortcuts" folder, favorites, and startmenu?)
@ECHO OFF

Del /Q /S /F" %ALLUserprofile%\desktop\corporate shortcuts\ezLabor.lnk"
Del /Q /S /F" %ALLUserprofile%\desktop\corporate shortcuts\ADP ezLabor.lnk"

etc etc..

Del /Q /S /F" %ALLUserprofile%\favorites\ezLabor.lnk"

etc etc..

Del /Q /S /F" %ALLUserprofile%\Start Menu\CSA\ezLabor.lnk"

etc etc..
END
 

What I will be using thus far:

1) Copy the new icon over to the local machine(s)(BATCH):

xcopy "\\network path\adpportal.ico" "%systemroot%\icons" /C /H /R /Y

2) Place desktop shortcut (VBS):

'CreateSC.vbs
Dim objShell:Set objShell=CreateObject("Wscript.Shell")
strLogonServer = objShell.ExpandEnvironmentStrings("%LOGONSERVER%")
strAllUsersDesktop = objShell.ExpandEnvironmentStrings("%ALLUSERSPROFILE%") & "\Desktop\"
Dim objSC: Set objSC=objShell.CreateShortCut(strAllUsersDesktop & "\ADP Portal.lnk")
With objSC
  .WorkingDirectory="https://portal.adp.com" (?)
  .TargetPath="http:"https://portal.adp.com" (?)
  .IconLocation =""%systemroot%\icons\adpportal.ico"
  .Save
End With
Set objSC=Nothing
Set objShell=Nothing


3) To add the startmenu shortcut?? (VBS):
Const ADMINISTRATIVE_TOOLS = 6

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(CSA) 
Set objFolderItem = objFolder.Self     

Set objShell = WScript.CreateObject("WScript.Shell")
strDesktopFld = objFolderItem.Path
Set objURLShortcut = objShell.CreateShortcut(strDesktopFld & "\Example.url")
objURLShortcut.TargetPath = "http://www.example.com"
objURLShortcut.Save

OR SHOULD IT BE (Batch):

xcopy "\\C:\Documents and Settings\All Users\Desktop\(newlink from above).lnk" "C:\Documents and Settings\All Users\Start Menu\CSA" /C /H /R /Y

(Same for the allusers favorites folder below?)

xcopy "\\C:\Documents and Settings\All Users\Desktop\(newlink from above).lnk" "C:\Documents and Settings\All Users\favorites" /C /H /R /Y


For the Removal Process, remove shortcuts/icons from the "Corporate Shortcuts" desktop folder (all users) on the local machine(s)(BATCH)::

@echo off
setlocal
 
set files="iPAY-adp.lnk" "ADP-iPAY.lnk" "ADP-iPAY.lnk" "ezLabor.lnk" "ADP ezLabor.lnk" "HRB.lnk"
for %%G in (%files%) do del /f /s /q "%allusersprofile%\..\%%~G" (*How do I configure this to run within the desktop\corporate shortcuts folder?)
 
exit



TO REMOVE OLD <ALL> SHORTCUTS?:

(for the desktop "corporate shortcuts" folder, favorites, and startmenu?)
@ECHO OFF 

Del /Q /S /F" %ALLUserprofile%\desktop\corporate shortcuts\ezLabor.lnk" 
Del /Q /S /F" %ALLUserprofile%\desktop\corporate shortcuts\ADP ezLabor.lnk"

etc etc.. 

Del /Q /S /F" %ALLUserprofile%\favorites\ezLabor.lnk"

etc etc..

Del /Q /S /F" %ALLUserprofile%\Start Menu\CSA\ezLabor.lnk"

etc etc..
END

Open in new window

SOLUTION
Avatar of shairozan
shairozan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of RobSampson
RobSampson
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
AngelIII, my code above should work as a StartUp script, so I think comment ID:26480654 should be the accepted answer.

Rob.