DSCM - Darek's System Configuration Manager

DSCM is a Microsoft System Center Configuration Manager (SCCM)'s simple alternative. It's a software deployment command line application which reads it's configuration files and decides if it should install needed software, uninstall it or just do nothing on the workstation with a Windows system. It runs batch scripts for every software version check, installation and uninstallation. It's quite easy to use if you know the basis of windows command prompt. You can download it for free, also for commercial use. Please refer to documentation below. You'll like this app.

Why should you use DSCM?

If you have several computers to configure, you can just install Windows system on all of them, configure hostname with network settings and finally setup DSCM. That's it! All the needed software you specified in the DSCM's configuration file will be installed after machines reboot. In the configuration file you can set a lot of unattened installation scripts for all computers or just a few of them specified by hostname. You can set DSCM's configuration file once and use it for all computers. This application saves you a lot of pain, because you don't have to remember to install software like Office package, Adobe Reader, 7-zip, antivirus, Java runtime, web browser, Oracle Client, etc. After you setup DSCM at Windows startup, the software is installed automatically. It's free of charge. It's created by IT administrator for other admins.

How to setup DSCM on Windows workstation?

DSCM should be set to run at Windows startup via GPO or gpedit.msc. Just expand Computer Configuration, Policies and click Scripts. In the right pane double click "startup". On the "scripts" tab click "show files" and then enter the UNC path to script which executes the dscm.exe process, like "\\192.168.0.5\share$\dscm.cmd". The sample dscm.cmd script content is:
net use \\192.168.0.1\share$ /user username:pass \\192.168.0.1\share\dscm.exe net use \\192.168.0.1\share$ /delete
It's important your workstations have read and execute permission of the dscm.exe's location.

How to set DSCM's software distribution location?

DSCM is ready to read other location of software distribution than itself's. Therefore you can place DSCM's executable files in other location than software installers. Anyway you have to create "software_location.ini" file next to dscm.exe, so the directory would contain dscm.exe and software_location.ini files. In the software_location.ini file you should write a line like this:
software_location=\\192.168.0.1\share$\software
It's also important, your workstations have read and execute permission of above location.

How to create simple installation/uninstallation package quite automatically?

Just enter this simple Setups creator.

What is software location directory structure?

The software location directory structure is:
+7zip + 
|     |- checker\exec.cmd
|     |
|     |- files\*
|     |
|     |- install ---+
|     |             |- 32bit\exec.cmd
|     |             |- 64bit\exec.cmd
|     |
|     |- uninstall -+
|     |             |- 32bit\exec.cmd
|     |             |- 64bit\exec.cmd
|     |
|     |- serial ----+
|                   |- 1\*
|                   |- 2\*
|                   |- (...)\*
+java
+otherappcode
+(...)

What is the main configuration file?

The main configuration file name is "software.csv" which should be saved in the same directory as dscm.exe and here it is a sample line:
7zip;7 Zip;19.00;0;i;minver;*;Joes-notebook
which means: You have to create each line like this for any software you want to automatically deploy. It's very simple.

How to create the installation/uninstallation package?

You have to create a subdirectory as it's described above about software location directory structure.

How to create a software checking version script

In the checkver\exec.cmd you have to create a code which detects software's installed version, ussually from windows registry, rather Powershell Get-WmiObject function or just from existance specified files.
For checking version from registry you can use additional app cregquery.exe which is good to return registry values from keys which includes spaces in the path. You can then just enter [:space:] instead "space" character:
%1\cregquery HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OCS[:space:]Inventory[:space:]NG[:space:]Agent DisplayVersion
This is a recommended method, because it's quite univseral and quick. Ussually DisplayVersion values are saved in
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
or
HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall
keys. Sometimes you'll find the version in CurrentVersion value in
HKLM\SOFTWARE\Mozilla\Mozilla Firefox
key ;)
Also you can get the software version via Powershell Get-WmiObject, but this method is slower:
powershell.exe -Command $ver=GetWmiObject -Query \"SELECT * FROM Win32_Product WHERE Name LIKE '7-Zip%'\"Select-Object Version;echo Version; ^| findstr /r /v "^$"
Another method is to check the file or directory exist:
if exist "C:\app\version.txt", but this is a naive method.
After you choose the version checking method, you have to output the version result in "{}" braces. And this is a complete code of checking version script:
 
@echo off chcp 65001 > nul set dscm_ver= REM 32-bit if not exist c:\Windows\SysWOW64 ( for /f "usebackq tokens=1 delims=() " %%v in (`%1\cregquery HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OCS[:space:]Inventory[:space:]NG[:space:]Agent DisplayVersion`) do ( set dscm_ver=%%v goto end1 ) ) REM 64-bit if exist c:\Windows\SysWOW64 ( for /f "usebackq tokens=1 delims=() " %%v in (`%1\cregquery HKLM SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\OCS[:space:]Inventory[:space:]NG[:space:]Agent DisplayVersion`) do ( set dscm_ver=%%v goto end1 ) ) :end1 if "%dscm_ver%" == "null" set dscm_ver=0 if "%dscm_ver%" == "" set dscm_ver=0 echo {%dscm_ver%}
 
As you can see it detects system architecture and then it uses the proper command to extract the version number to dscm_ver variable. Then this variable is printed out to console in {braces}. Every white character in those braces before and after version number is trimmed. Complete checkver script with Powershell Get-WmiObject method:
 
@echo off set dscm_ver= for /f "usebackq skip=1 tokens=*" %%v in (`powershell.exe -Command $ver=GetWmiObject -Query \"SELECT * FROM Win32_Product WHERE Name LIKE '7-Zip%'\"Select-Object Version;echo Version; ^| findstr /r /v "^$"`) do ( set dscm_ver=%%v goto end1 ) :end1 if "%dscm_ver%" == "" set dscm_ver=0 echo {%dscm_ver%}
 
The result of Get-WmiObject function is passed to the dscm_ver variable. And the last one with an existance of a file and reading of it's content:
 
@echo off set dscm_ver= if exist "C:\app\some.jar" ( if exist "C:\app\some.txt" ( for /f "tokens=1" %%i in (C:\app\some.txt) do ( set dscm_ver=%%i ) ) ) if "%dscm_ver%" == "" set dscm_ver=0 echo {%dscm_ver%}
 
In the above example the software version number is extracted from the text file.

Where can I save my software setup files?

You can store your setup files in the files subdirectory.

How to create the software install script?

You have to create install\{32bit|64bit}\exec.cmd file. You just enter then a path to your installation files which silent setup switches like this:
start /wait %1\%2\files\AcroRdrDC1900820071_pl_PL.exe /sPB /rs
You can also do other necessary things, like taskkill /IM AcroRd32.exe /T /F, or whatever you need.
You can reboot the remote computer directly after the installation via shutdown -r -t 0 command, or tell DSCM to reboot the workstation after all installations by creating C:\install\dscm_need_restart.txt file. And this is example of simple installation script:
 
@echo off taskkill /IM AcroRd32.exe /T /F start /wait %1\%2\files\AcroRdrDC1900820071_pl_PL.exe /sPB /rs reg.exe ADD "HKLM\SOFTWARE\Adobe\Adobe ARM\Legacy\Reader\{AC76BA86-7AD7-1045-7B44-AC0F074E4100" /v "Mode" /t REG_DWORD /d "0" /f echo Adobe Reader > C:\install\dscm_need_restart.txt

What about "serial" subdirectory?

The install\{32bit|64bit}\exec.cmd script gets 3 parameters: %1 - software_location path, %2 - software alias directory name, %3 - serial subdirectory number.
In the "serial" directory you can create as many subdirectories as you need. I named them with decimal numbers but their names could be also words without spaces and special characters.
In each serial's subdirectory you can put the serial number of your license in any needed format. For example if you want to install MS Office up to 2016 version, you have to save the *.msp file in that subdirectory.
If you have more than one license with several serial numbers, you can create many *.msp files and save them to several serial's subdirectories. If you have MS Office 2019, you can save several *.xml files to these subdirectories.
It's important that each "serial" file would have the same name. After that in the install\{32bit|64bit}\exec.cmd script you just enter this command to install older MS Office:
%1\%2\files\setup.exe /adminfile:%1\%2\serial\%3\my.msp
or to install 2019 version:
%1\%2\files\setup.exe /configure %1\%2\serial\%3\configuration.xml
However, the 2019 version install example isn't complete, because the 2019 configuration.xml files contains also architecture's type. Therefore if you want to create universal solution to install these software on 32 and 64 bit platforms, you have to differ those xml files by saving them in the additional subdirectories "32bit|64bit". After that the complete install example line for 32bit is:
%1\%2\files\setup.exe /configure %1\%2\serial\%3\32bit\configuration.xml
and for 64bit:
%1\%2\files\setup.exe /configure %1\%2\serial\%3\64bit\configuration.xml
It's important to set in those xml files parameter OfficeClientEdition="32" and ="64".
After that you can use above serial files in the software.csv:
 
#2016 msoffice2016std;MS Office 2016 std;2016;1;i;minver;wks1,wks2 msoffice2016std;MS Office 2016 std;2016;2;i;minver;wks3 #2019 msoffice2019std;MS Office 2019 std;2019;1;i;minver;wks4,wks5 msoffice2019std;MS Office 2019 std;2019;2;i;minver;wks6

How to create software uninstall script?

You have to create uninstall\{32bit|64bit}\exec.cmd file. You just enter then a path to your uninstaller which silent setup switches like this:
MsiExec.exe /X{AC76BA86-7AD7-1045-7B44-AC0F074E4100} /qb /norestart
You can often find the unistall string in the registry next to the "display version" value.
You can also do other necessary things, like taskkill /IM AcroRd32.exe /T /F, or whatever you need.
And this is example of simple uninstallation script:
 
@echo off taskkill /IM AcroRd32.exe /T /F MsiExec.exe /X{AC76BA86-7AD7-1045-7B44-AC0F074E4100} /qb /norestart

What is comment character? ;)

You can leave comments in your software.csv by placing the "#" character at the beginning of the line.

Does the uninstall\{32bit|64bit}\exec.cmd need the software version from the software.csv line?

No, it doesn't need the version number to uninstall the software. The third column in the config file to uninstall the software is only for compatibility. You can type there anything if the line is for uninstall:
7zip;7-Zip;anything;0;u;minver;*
 
 
© ithero.ovh