1

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"} 
MattG78
  • 35
  • 6
  • 1
    Your last script (starting with `$computers = Get-Content...` is PowerShell. Why is PowerShell not an option? On Windows 7 and later, it is distributed as part of Windows, so it should not fall under the third-party prohibition. – Jeff Zeitlin Jul 17 '17 at 14:12
  • It is an enterprise sized network, and I'm just a peon trying to get the job done. They are blocked by policy. – MattG78 Jul 17 '17 at 14:14
  • What tools _do_ you have that are not blocked by policy? "Native Windows tools" isn't an adequate answer, as you've indicated that a native windows tool - PowerShell - is, in fact, blocked. – Jeff Zeitlin Jul 17 '17 at 14:17
  • The only "scripting" I can do is vbs and batch files. So wmic, cmd calls, etc. I have no problem trying things, and will report a success or failure. What I meant was that I can't use 3rd party apps. – MattG78 Jul 17 '17 at 14:19
  • 1
    You may find [this vbscript function](https://helloacm.com/vbscript-function-to-run-program-at-remote-computer/) to be of interest. – Jeff Zeitlin Jul 17 '17 at 14:40
  • How do I get `'Input: sstrExe = Exe or command to execute (can pass full command line)` to prompt for file browser? – MattG78 Jul 17 '17 at 15:26
  • That line is a comment; the function as written expects to be passed the command line and computer name as parameters. I suggest you do a bit more studying of VBScript before you attempt to use or modify a script obtained from the 'net; if you don't understand what's going on, how can you be sure that the script isn't going to do something harmful? – Jeff Zeitlin Jul 17 '17 at 15:32
  • I'd like to mention a few things: installs on corporate networks (of windows workstations) are supposed to be done through microsoft active directory domain server. This is one of the prime reasons MSI format even exists - you choose MSI and select computers it needs to be installed on and that's it. This is why people are wrapping EXE installers in MSIs ( https://stackoverflow.com/questions/854873/how-to-make-an-msi-that-simply-wraps-an-exe-file ). Why and how does "just a peon" have security rights to *install software remotely* but not to access domain controller or even use relevant tools? – Jack White Mar 08 '21 at 05:30
  • At the time we didn't have SCCM, SMS wasn't functioning as it should, and as a helpdesk tech, you tried to do whatever you could as efficiently (and completely) as possible. – MattG78 Mar 08 '21 at 12:04

0 Answers0