1. Linux
1.1. Build
Build of Delta Windows Tools installer files.
-
Install Git.
-
Log in as smru on tbhf-anc-mrm.
-
Enter the following commands at a Command Line.
mkdir -p ~/github/git/delta-software-labs cd ~/github/git/delta-software-labs git clone https://delta-software-labs@github.com/delta-software-labs/Windows-Tools.gitsudo apt-get install p7zip sudo apt-get install unzip zip cd ~/github/git/delta-software-labs/Windows-Tools make clean-all make make windows
1.2. Self Extracting (SFX) Archive
Windows XP Support: Microsoft ended support for Windows XP on April 8, 2014. Current versions of the Visual C Redistributable for Visual Studio 2015-2022 only support Windows 7, 8.1, 10, and 11. The last version of the Visual C Redistributable that works on Windows XP shipped in Visual Studio 2019 version 16.7 (file versions starting with 14.27). The Redistributable is available in the my.visualstudio.com Downloads section as Visual C++ Redistributable for Visual Studio 2019 (version 16.7). Use the Search box to find this version. To download the files, select the platform and language you need, and then choose the Download button.
The documentation at https://learn.microsoft.com/en-us/cpp/build/configuring-programs-for-windows-xp?view=msvc-170&source=docs says "The toolset supplied in Visual Studio 2019 and later doesn’t include support for creating code for Windows XP. Support for Windows XP development is available by using the Visual Studio 2017 v141_xp toolset. You can install the v141_xp toolset as an individual component option in the Visual Studio Installer."
-
Install Visual Studio 2010.
-
Download the 7z2409-src.7z file and extract the contents to the C:\Tmp\7z2409 folder.
-
Select the C:\Tmp\7z2409\CPP\7zip\Bundles\SFXSetup folder.
-
Make a copy of the SfxSetup.cpp file and rename it SfxSetup.cpp.org.
-
See https://sourceforge.net/p/sevenzip/discussion/45797/thread/28884697.
-
See https://github.com/samyakranjan/LZMA-SDK/releases/tag/1900-SfxSetup.
-
Make the following changes to the SfxSetup.cpp file to fix exit code always being zero.
if (hProcess) if (hProcess) { { WaitForSingleObject(hProcess, INFINITE); WaitForSingleObject(hProcess, INFINITE); > DWORD exitCode; > GetExitCodeProcess(hProcess, &exitCode); ::CloseHandle(hProcess); ::CloseHandle(hProcess); > return exitCode; } } return 0; return 0; } }
-
Select Start > Programs > Microsoft Visual Studio 2010 > Visual Studio Tools > Visual Studio Command Prompt (2010).
cd C:\Tmp\7z2409\CPP\7zip\Bundles\SFXSetup rmdir /q /s o nmake copy /y o\7zS.sfx C:\Tmp\7zS-vs2010-2409-x86.sfx copy /y o\7zS.sfx C:\Tmp\7zSConsole-vs2010-2409-x86.sfx editbin.exe C:\Tmp\7zSConsole-vs2010-2409-x86.sfx /subsystem:console fc.exe /b C:\Tmp\7zS-vs2010-2409-x86.sfx C:\Tmp\7zSConsole-vs2010-2409-x86.sfx rmdir /q /s o exit
-
Select Start > Programs > Microsoft Visual Studio 2010 > Visual Studio Tools > Visual Studio x64 Win64 Command Prompt (2010).
REM 7z2409: Prevent: 'ml' is not recognized as an internal or external command, operable program or batch file. set PLATFORM set PLATFORM=x64 set PLATFORM cd C:\Tmp\7z2409\CPP\7zip\Bundles\SFXSetup rmdir /q /s x64 nmake copy /y x64\7zS.sfx C:\Tmp\7zS-vs2010-2409-x64.sfx copy /y x64\7zS.sfx C:\Tmp\7zSConsole-vs2010-2409-x64.sfx editbin.exe C:\Tmp\7zSConsole-vs2010-2409-x64.sfx /subsystem:console fc.exe /b C:\Tmp\7zS-vs2010-2409-x64.sfx C:\Tmp\7zSConsole-vs2010-2409-x64.sfx rmdir /q /s x64 exit
2. Windows
2.1. Build
Build of Delta Windows Tools installer files
-
Install Mercurial.
-
Install WIX Toolset.
-
Enter the following commands at a Command Line.
mkdir D:\GitHub\Git\SMRU cd D:\GitHub\Git\SMRU git clone https://delta-software-labs@github.com/delta-software-labs/Documentation.git git clone https://delta-software-labs@github.com/delta-software-labs/Windows-Tools.git cd "D:\GitHub\Git\Delta Software Labs\Windows\Windows-Tools" cd "D:\GitHub\Git\Delta Software Labs\Windows\Delta Software Labs\Windows-Tools" Build.bat // candle.exe Delta-Windows-Tools-4.5.3-x64.wxs // candle.exe Delta-Windows-Tools-4.5.3-x86.wxs // light.exe Delta-Windows-Tools-4.5.3-x64.wixobj // light.exe Delta-Windows-Tools-4.5.3-x86.wixobj // light.exe -ext WixUIExtension Delta-Windows-Tools-4.5.3-x64.wixobj // light.exe -ext WixUIExtension Delta-Windows-Tools-4.5.3-x86.wixobj dir
2.2. Installation
-
Enter the following commands at a Command Prompt with administrative privileges.
-
Right-click Start > Windows System > Command Prompt and select More > Run as administrator.
net use W: \\SMRU-HyperV01\Windows$ /Persistent:No dir W:\Software\_Delta\Delta-Windows-Tools-4.5.7-x86.exe (1) dir W:\Software\_Delta\Delta-Windows-Tools-4.5.7-x64.exe (2) W:\Software\_Delta\Delta-Windows-Tools-4.5.7-x86.exe (1) W:\Software\_Delta\Delta-Windows-Tools-4.5.7-x64.exe (2) net use T: \\SMRU-SRV\Teams$ /Persistent:No (3) Set-WindowsConfiguration1 32-bit Windows. 2 64-bit Windows. 3 SMRU-IT computers. -
-
Do the following for Windows 7 Professional.
-
Start Windows Explorer.
-
Select the C:\Recovery\<guid> folder.
-
Copy the Winre.wim file and rename it to Winre.org.
-
32-bit: Copy the W:\Software\SMRU\Recovery\Winre32.wpa file to the C:\Recovery\<guid> folder.
-
64-bit: Copy the W:\Software\SMRU\Recovery\Winre64.wpa file to the C:\Recovery\<guid> folder.
-
Close Windows Explorer.
-
-
Restart the computer.
2.3. Uninstallation
-
Enter the following commands at a Command Prompt with administrative privileges.
-
Right-click Start > Windows System > Command Prompt and select More > Run as administrator.
# Open Command Prompt. Uninstall-SmruWindowsTools # Install latest Delta Windows Tools: Delta-Windows-Tools-4.5.7Beta-x64.exe # Quit Command Prompt. # Open Command Prompt. Set-WindowsConfiguration # Quit Command Prompt. # Restart the computer. # Open Command Prompt. Undo-TerminalServer Undo-WindowsConfiguration Uninstall-DeltaWindowsTools # Quit Command Prompt. # Open Command Prompt. # Install latest Delta Windows Tools: Delta-Windows-Tools-4.5.7Beta-x64.exe # Quit Command Prompt. # Open Command Prompt. Set-WindowsConfiguration Show-Inventory # Quit Command Prompt. # Open Command Prompt. dir C:\Windows\System32\smru-termsrv.dll powershell.exe $Null = New-PSDrive -Scope Global -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT; Get-ItemProperty -ErrorAction SilentlyContinue -Path "HKCR:\smru-*" # Quit Command Prompt.
-
2.3.1. Remote installations
Installations using the Execute action of the Remote.cmd command may fail due to registry redirection and / or file system redirection. Either the Bitvise SSH server or PLINK.EXE is causing the problem.
This is for example the case with Clink. When installed with the Execute action the "AutoRun" value in the HKLM\Software\Microsoft\Command Processor registry key is not updated. Instead the "AutoRun" value is updated in the HKLM\Software\Wow6432Node\Microsoft\Command Processor registry key.
Using the Execute action also fails when installing PowerShell 4.0. Also, cannot use the Execute action to update the Bitvise SSH Server, because it stops the SSH connection during the update process.
The only secure way for installations is to use the Schedule action.
2.4. Orphaned Tasks
Sometimes a task is not shown in the task scheduler but is still present and prevents scheduling of a new task. It is orphaned.
Remove orphaned tasks
-
Solution 1
net use W: \\tbhf-anc-mrm\Windows$ /P:No /U:smru "W:\Software\Microsoft\SysInternals\\PsExec-2.11.exe" -accepteula -hsi cmd.exe set "Key=HKLM\Software\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree" reg delete "%Key%\Remote-Command" /f reg delete "%Key%\SMRU-Remote-Cmd" /f exit -
Solution 2
set "Command=schtasks /Delete /TN Remote-Command /F" plink.exe -i "%UserProfile%\id_rsa-auto.ppk" "Administrator@SMRUWS-IT00" !Command! set "Command=schtasks /Delete /TN SMRU-Remote-Cmd /F" plink.exe -i "%UserProfile%\id_rsa-auto.ppk" "Administrator@SMRUWS-IT00" !Command! -
Solution 3
Remote.cmd /A Run "schtasks /Delete /TN Remote-Command /F" 2> nul Remote.cmd /A Run "schtasks /Delete /TN SMRU-Remote-Cmd /F" 2> nul// Remote.cmd /A Run "schtasks /Delete /TN Remote-Command /F" 2> nul Remote.cmd /A Run "schtasks /Delete /TN SMRU-Remote-Cmd /F" 2> nul
2.5. Remote Commands
-
Enter the following commands at a Command Prompt.
Test-Message # Press Ctrl+Alt+E to expand the DosKey macro. # powershell.exe -Command "Import-Module -DisableNameChecking -Name 'C:\Program Files\Delta Software Labs\Windows-Tools\Settings.psm1'; Test-Message " set "Command=powershell.exe -Command "Import-Module -DisableNameChecking -Name 'C:\Program Files\Delta Software Labs\Windows-Tools\Settings.psm1'; Test-Message"" ssh.exe -i "%UserProfile%\id_rsa-auto" "Administrator@TBHFWS-IT01" %Command% echo %ErrorLevel%set "Command=cscript.exe \"%ProgramFiles%\Microsoft Office\Office16\OSPP.VBS\" /dstatus" ssh.exe -i "%UserProfile%\id_rsa-auto" "Administrator@TBHFWS-IT01" %Command% echo %ErrorLevel%
-
Enter the following commands at a PowerShell Command Prompt.
. 'C:\Program Files\Delta Software Labs\Windows-Tools\Debug.ps1' Test-Message $Command = "powershell.exe -Command `"Import-Module -DisableNameChecking -Name 'C:\Program Files\Delta Software Labs\Windows-Tools\Settings.psm1'; Test-Message`"" $LastExitCode = 0 ssh.exe -i "${Env:UserProfile}\id_rsa-auto" "Administrator@TBHFWS-IT01" $Command $LastExitCode. 'C:\Program Files\Delta Software Labs\Windows-Tools\Debug.ps1' $Path = "O:\Inventory" $File = "$Path\Computers.cmtsv" $Computers = Get-Content -Path $File | Where-Object { $_ -notmatch "^#|^$" } | Select-Object -Skip 1 $Computers = $Computers -match "SMRUNB|SMRUWS|TBHFNB|TBHFWS" $Computers = $Computers -replace "\s.*", "" $Computers = $Computers -notmatch "smrunb-anc" $Computers = $Computers | Sort-Object foreach ($Computer in $Computers) { # $Command = "dir /b \`"C:\Program Files\Mozilla Firefox\defaults\`" & dir /b \`"C:\Program Files (x86)\Mozilla Firefox\defaults\`"" # $Command = "dir /b \`"C:\Program Files\Google\Chrome\`" & dir /b \`"C:\Program Files (x86)\Google\Chrome\`"" # $Command = "dir /b \`"C:\Program Files\Vim\vimrc\`" & dir /b \`"C:\Program Files (x86)\Vim\vimrc\`"" # $Command = "dir \`"C:\Program Files\Mozilla Firefox\firefox.exe\`"" # $Command = "dir \`"C:\Program Files (x86)\Mozilla Firefox\firefox.exe\`"" # $Command = "dir /a `"C:\$Computer.log`"" $Command = "set DELTA_CONFIGURATION" if (Test-Connection -ComputerName $Computer -Count 1 -Quiet) { $Answer = Send-Command $Computer $Command "$Computer`t$($Answer.Reply)" } }
2.6. Remote Sites
-
Note: The PMS server at each clinic can be used to remotely control all the Windows computers at that clinic.
2.6.1. Preparations
-
Install Samba Server on tbhf-anc-mkt, tbhf-anc-mla, tbhf-anc-msl or tbhf-anc-wpa.
-
Log in as smru at tbhf-anc-mkt, tbhf-anc-mla, tbhf-anc-msl or tbhf-anc-wpa.
sudo useradd --comment PowerShell -M --shell /sbin/nologin --uid 1100 pwsh
sudo passwd pwsh (1)
sudo smbpasswd -a pwsh (2)
sudo mkdir -p /home/Other/Bin
sudo mkdir -p /home/Other/Shared
sudo mkdir -p /home/Other/Software
sudo mkdir -p /home/Other/Upload
sudo chown delta:delta /home/Other/Bin
sudo chown delta:delta /home/Other/Shared
sudo chown delta:delta /home/Other/Software
sudo chown delta:delta /home/Other/Software
ls -al /home/Other
| 1 | Type p0wershell for the password. |
| 2 | Type p0wershell for the password. |
-
Log in as smru at tbhf-anc-mrm.
cd /media/Windows/Software
scp -p /home/Other/Bin/*.exe delta@tbhf-anc-wpa:/home/Other/Bin
scp -p 7-Zip/7z1806.msi delta@tbhf-anc-wpa:/home/Other/Software
scp -p 7-Zip/7z1806-x64.msi delta@tbhf-anc-wpa:/home/Other/Software
scp -p Adobe/Adobe\ Acrobat\ Reader\ DC/AcroRdrDC1900820081_en_US.exe delta@tbhf-anc-wpa:/home/Other/Software
scp -p Bitvise/BvSshServer-Inst-8.27.exe delta@tbhf-anc-wpa:/home/Other/Software
scp -p Bitvise/id_rsa-auto.pub delta@tbhf-anc-wpa:/home/Other/Software
scp -p Clink/vcredist_x64-10.0.30319.01.exe delta@tbhf-anc-wpa:/home/Other/Software
scp -p Clink/vcredist_x86-10.0.30319.01.exe delta@tbhf-anc-wpa:/home/Other/Software
scp -p Clink/clink_0.4.9_setup.exe delta@tbhf-anc-wpa:/home/Other/Software
scp -p Google/Google\ Chrome/GoogleChromeStandaloneEnterprise-70.0.3538.102.msi delta@tbhf-anc-wpa:/home/Other/Software
scp -p Malwarebytes/mb3-setup-consumer-3.6.1.2711-1.0.482-1.0.7841.exe delta@tbhf-anc-wpa:/home/Other/Software
scp -p Microsoft/Skype/Skype-8.34.0.78.exe delta@tbhf-anc-wpa:/home/Other/Software
scp -p Microsoft/WMF\ \(Windows\ Management\ Framework\)/WMF\ 4.0/Windows6.1-KB2819745-x64-MultiPkg.msu delta@tbhf-anc-wpa:/home/Other/Software
scp -p Microsoft/WMF\ \(Windows\ Management\ Framework\)/WMF\ 4.0/Windows6.1-KB2819745-x86-MultiPkg.msu delta@tbhf-anc-wpa:/home/Other/Software
scp -p Mozilla/Firefox\ Setup\ 63.0.3.exe delta@tbhf-anc-wpa:/home/Other/Software
scp -p Open-Shell/OpenShellSetup_4_4_131.exe delta@tbhf-anc-wpa:/home/Other/Software
scp -p philandro\ \(AnyDesk\)/AnyDesk-3.7.0.0.exe delta@tbhf-anc-wpa:/home/Other/Software
scp -p philandro\ \(AnyDesk\)/AnyDesk-4.3.0.0.exe delta@tbhf-anc-wpa:/home/Other/Software
scp -p Piriform/ccsetup549_slim.exe delta@tbhf-anc-wpa:/home/Other/Software
scp -p Piriform/dfsetup222.exe delta@tbhf-anc-wpa:/home/Other/Software
scp -p Smartmontools/smartmontools-7.0-1.win32-setup.exe delta@tbhf-anc-wpa:/home/Other/Software
scp -p _SMRU/Delta-Windows-Tools-4.5.6-x64.exe delta@tbhf-anc-wpa:/home/Other/Software
scp -p _SMRU/Delta-Windows-Tools-4.5.6-x86.exe delta@tbhf-anc-wpa:/home/Other/Software
scp -p SuperAntiSpyware/SUPERAntiSpyware-8.0.0.1030.exe delta@tbhf-anc-wpa:/home/Other/Software
scp -p TeamViewer/TeamViewer\ 11/TeamViewer_Host_Setup-11.0.93231.exe delta@tbhf-anc-wpa:/home/Other/Software
scp -p Tordex\ \(Free\ Launch\ Bar\)/freelaunchbar32.exe delta@tbhf-anc-wpa:/home/Other/Software
scp -p Tordex\ \(Free\ Launch\ Bar\)/freelaunchbar64.msi delta@tbhf-anc-wpa:/home/Other/Software
scp -p VideoLAN/vlc-3.0.6-win32.exe delta@tbhf-anc-wpa:/home/Other/Software
scp -p VideoLAN/vlc-3.0.6-win64.exe delta@tbhf-anc-wpa:/home/Other/Software
ssh delta@tbhf-anc-wpa "vdir /home/Other/Software"
ssh delta@tbhf-anc-wpa "md5sum /home/Other/Software/*"
ssh delta@tbhf-anc-wpa "rm /home/Other/Software/ccsetup512.exe"
msg * /time:3600 "HH:MM Douwe: Please restart this computer."
|
Troubleshooting connection problems with the created shares.
|
-
Log on as Administrator at SMRU-PMS-MKT/SMRU-PMS-MLA/SMRU-PMS-WPA.
net use W: \\192.168.25.1\Windows$ /P:No /User:smru W:\Software\Delta-Windows-Tools-4.5.6-x86.exe -
Log on as Administrator at SMRU-PMS-MKT/SMRU-PMS-MLA/SMRU-PMS-WPA.
Remote.cmd 192.168.25.2 Status Remote.cmd 192.168.25.2 Inventory copy /y SMRU-PMS-WPA.* W:\Inventory Remote.cmd SMRU-PMS-WPA Status start /wait W:\Software\clink_0.4.9_setup.exe /S <????> -
Log on as Administrator at SMRU-PMS-MKT/SMRU-PMS-MLA/SMRU-PMS-WPA.
[opt]*Optional:* net use W: \\192.168.25.1\Windows$ /P:No /User:smru [opt]*Optional:* Remote.cmd 192.168.25.6 Schedule W:\Software\BvSshServer-Inst-7.16.exe "-defaultSite -acceptEULA" [opt]*Optional:* Remote.cmd 192.168.25.6 Schedule W:\Software\Windows6.1-KB2819745-x86-MultiPkg.msu "/quiet /norestart" [opt]*Optional:* shutdown.exe /r /t 30 -
Log on as Administrator at SMRU-PMS-MKT/SMRU-PMS-MLA/SMRU-PMS-WPA.
net use W: \\192.168.25.1\Windows$ /P:No /User:smru Routines :Net.Ping 192.168.25 1 arp -a net view ping -4 -a 192.168.25.### Remote.cmd 192.168.25.### Status Remote.cmd 192.168.25.### Status Remote.cmd 192.168.25.### Schedule W:\Software\clink_0.4.9_setup.exe /S Remote.cmd 192.168.25.### Schedule W:\Software\Delta-Windows-Tools-4.5.6-x86.exe /q Remote.cmd 192.168.25.### Inventory copy /y SMRU*.* W:\Inventory Remote.cmd /A Status setx DELTA_WAKE_ON_LAN ##:##:##:##:##:## /m
2.6.2. Usage
mosh tbhf-anc-wpa ssh Administrator@192.168.25.2