To preface, I cannot use PSExec. I can't use Powershell. Third party utilities are forbidden, so I have to work within native Windows abilities.
Currently, I can install msi remotely with little issue. But Now, I have to come up with a way to run executables as well (potentially with commandline arguements).
I'd like to reference a txt file list (even for one offs) to provide computer names. However, I'd like to have a prompt/file browser for the installer I'd like to run with would be located on a network share.
My current MSI script is:
@ECHO off
SETLOCAL ENABLEDELAYEDEXPANSION
for /f %%i in (C:\Support\BatchTests\chrome.txt) DO (
ECHO *********************************************************
ECHO.
ECHO Installing Chrome on %%i. Stand by...
ECHO.
ECHO *********************************************************
Xcopy "\\Network\Path\To\Resource\googlechromestandaloneenterprise64.msi" "\\%%i\C$\Support\" /E /C /H /R /Y
wmic /node:%%i product call install true,"","\\%%i\C$\Support\googlechromestandaloneenterprise64.msi"
DEL /Q "\\%%i\C$\Support\googlechromestandaloneenterprise64.msi"
)
It would be great if the script detected the type of file (msi/exe) to run the proper code. With the addition of an output file for verification.
I found a sepperate code for remote .exe execution, but I get an error when I try to run it.
C:\Support\BatchTests\SWInstaller.vbs(1, 1) Microsoft VBScript compilation error : Invalid character
$computers = Get-Content "C:\Support\BatchTests\swinstall.txt"
foreach ($computer in $computers) {
#The location of the file
$Install = "\\Network\Resource\To\Install\Path\Mozilla FireFox"
#The Install string can have commands aswell
$InstallString = "$Install\Firefox Setup 54.0.exe"
([WMICLASS]"\\$computer\ROOT\CIMV2:Win32_Process").Create($InstallString)
#Output the install result to your Local C Drive
Out-File -FilePath c:\Support\BatchTests\installed.txt -Append -InputObject "$computer"}