/build/static/layout/Breadcrumb_cap_w.png

copy a shortcut to all users

hello all-

just checking if anyone have a script of batch file they can share. i am trying to copy a file to all users desktop for windows xp and windows 7.

 

thanks in advance!

 

alex


0 Comments   [ + ] Show comments

Answers (3)

Posted by: tmlambert13 12 years ago
Senior White Belt
6

@echo off

ver | find "XP" > nul
if %ERRORLEVEL% == 0 goto ver_xp

if not exist %SystemRoot%\system32\systeminfo.exe goto warnthenexit

systeminfo | find "OS Name" > %TEMP%\osname.txt
FOR /F "usebackq delims=: tokens=2" %%i IN (%TEMP%\osname.txt) DO set vers=%%i

echo %vers% | find "Windows 7" > nul
if %ERRORLEVEL% == 0 goto ver_7


goto warnthenexit

:ver_7
:Run Windows 7 specific commands here.
copy /Y <shortcut file> %public%\Desktop\<filename>
goto exit


:ver_xp
:Run Windows XP specific commands here.
copy /Y <shortcut file>
%ALLUSERSPROFILE%\Desktop\<filename>
goto exit


:warnthenexit
echo Machine undetermined.

:exit


Comments:
  • thanks for the info tmlabert13 for the shortcut file location do i type the location where the file resides - brighstarcuit 12 years ago
  • %allusersprofile% will work for both Win 7 and XP. - dugullett 12 years ago
  • dugullet how can i deploy a batch file in kace - brighstarcuit 12 years ago
  • i have the batch file in place how can i run this in kace @echo off

    :ver_xp and 7
    :Run Windows XP specific commands here.
    copy /Y C:\teller.lnk %ALLUSERSPROFILE%\Desktop\teller.lnk
    goto exit

    :exit - brighstarcuit 12 years ago
  • have any of you guys push a batch file using kace - brighstarcuit 12 years ago
    • Upload the batch as a dependency. Use the task "Launch a program" with the location of: $(KACE_DEPENDENCY_DIR)\yourbatch.bat.

      Also use a verify step that shows the shortcut has been deployed, otherwise the script will keep running. - jknox 12 years ago
      • you good at scripting right will this script work

        '===========
        Set objFSO = CreateObject("Scripting.FileSystemObject")
        Set objShell = CreateObject("WScript.Shell")
        Set objProcess = objShell.Environment("Process")
        strDesktop = objProcess.Item("UserProfile") & "\Desktop\"
        boolOverwrite = False
        objFSO.CopyFile "\\server\share\shortcut.lnk", strDesktop, boolOverwrite
        '========== - brighstarcuit 12 years ago
  • on sucess
    launch: a program

    directory: $(KACE_SYS_DIR)

    file:

    parameters $(KACE_DEPENDENCY_DIR)\teller.bat

    what do i use for the file and how can i verify the shortcut is in place

    thanks - brighstarcuit 12 years ago
Posted by: jknox 12 years ago
Red Belt
3

I'd just use a script that unzips the shortcuts into place.

Use the verify task to determine XP by verifying that C:\Documents and Settings exists, then use on success to unzip your shortcut to C:\Documents and Settings\All Users\Desktop.

Use remediation to unzip the shortcut to C:\Users\Public\Desktop\ for Win7.


Comments:
  • hey jknox for Remediation what do i put for the Directory: - brighstarcuit 12 years ago
    • You will probably have to map the file location on the machine by using $(KACE_DEPENDENCY_DIR) - jknox 12 years ago
Posted by: Roonerspism 12 years ago
Second Degree Brown Belt
2

There's always the desktop shortcut wizard under Scripting->Configuration Policy too.

Not 100% sure if this does all users though.


Comments:
  • tthat wizard can only copy to the current logon user - brighstarcuit 12 years ago
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ