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

Comments

Please log in to comment

Community Chosen Answer

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

Answered 09/19/2012 by: tmlambert13
Senior White Belt

  • thanks for the info tmlabert13 for the shortcut file location do i type the location where the file resides
  • %allusersprofile% will work for both Win 7 and XP.
  • dugullet how can i deploy a batch file in kace
  • 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
  • have any of you guys push a batch file using kace
    • 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.
      • 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
        '==========
  • 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
Please log in to comment

Answers

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.

Answered 09/19/2012 by: jknox
Red Belt

  • hey jknox for Remediation what do i put for the Directory:
    • You will probably have to map the file location on the machine by using $(KACE_DEPENDENCY_DIR)
Please log in to comment
2

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

Not 100% sure if this does all users though.

Answered 09/19/2012 by: Roonerspism
Second Degree Brown Belt

  • This content is currently hidden from public view.
    Reason: Removed by user request
    For more information, visit our FAQ's.
  • tthat wizard can only copy to the current logon user
Please log in to comment
This content is currently hidden from public view.
Reason: Removed by user request
For more information, visit our FAQ's.

Answer this question or Comment on this question for clarity