Forums on Intune, SCCM, and Windows 11

Welcome to the forums. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your topics and posts, as well as connect with other members through your own private inbox!

PENDING Run a Package that contains only a command and no files

Kent Shaffer

New Member
Messages
4
Reaction score
0
Points
1
There has to be a simple answer to this and I am missing it.

Here is what I want to run:

MsiExec.exe /X{89F4137D-6C26-4A84-BDB8-2E5A4BB71E00} /qn

Really all I need to do is run this command on a remote machine. Is there actually any files in the package? I would think no. Correct me if I am wrong. If it does not contain any files, how do I run the above command on the remote machine utilizing SCCM packaging or applications? Please advise...

Do I have to create a file something.bat and place this command in it? If so, when I kick off the bat file, does it execute from the ccmcache folder, the temp directory .. or somewhere else?
 
Hi,

Suppose you are trying to install Microsoft Silverlight

Create a bat file using the following:


::::::::::
:: Prep :: -- Don't change anything in this section
::::::::::
@echo off
set SCRIPT_VERSION=1.0.0
set SCRIPT_UPDATED=2014-07-25
:: Get the date into ISO 8601 standard date format (yyyy-mm-dd) so we can use it
FOR /f %%a in ('WMIC OS GET LocalDateTime ^| find "."') DO set DTS=%%a
set CUR_DATE=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2%

:: This is useful if we start from a network share; converts CWD to a drive letter
pushd "%~dp0"
cls

:::::::::::::::
:: VARIABLES :: -- Set these to your desired values
:::::::::::::::
:: Log location and name. Do not use trailing slashes (\)
set LOGPATH=%SystemDrive%\Logs
set LOGFILE=

:: Package to install. Do not use trailing slashes (\)
set LOCATION=
set BINARY=Silverlight v5.1.40416.0 x64.exe
set FLAGS=/q /noupdate

:: Create the log directory if it doesn't exist
if not exist %LOGPATH% mkdir %LOGPATH%


::::::::::::::::::
:: INSTALLATION ::
::::::::::::::::::
:: Install the package from the local folder (if all files are in the same directory)
"%BINARY%" %FLAGS%

:: This line disabled the Auto Updater via the registry key
:: Values are:
:: 0x00000000 - Auto Update
:: 0x00000001 - Prompted Updates (the worst kind...)
:: 0x00000002 - No Updates
reg add "HKEY_LOCAL_MACHINE\Software\Microsoft\Silverlight" /v UpdateMode /t REG_DWORD /d 0x00000002 /f

:: This line deletes the Start Menu icons
if exist "%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Microsoft Silverlight" rmdir /s /q "%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Microsoft Silverlight"

:: Pop back to original directory. This isn't necessary in stand-alone runs of the script, but is needed when being called from another script
popd

:: Return exit code to SCCM/PDQ Deploy/etc
exit /B %EXIT_CODE%




Then use the following commamd line: cmd.exe /s /c ""Silverlight v5.1.40416.0 x64.bat" /q"
 

Forum statistics

Threads
7,135
Messages
27,867
Members
18,155
Latest member
DanDanDanissimo
Back
Top