Solved

Initiating WMIC from within a Powershell Script

Posted on 2010-11-26
2
652 Views
Last Modified: 2012-05-10
OK so here's my script thusfar:

#script to remotely install software"

#prompt for destination computer name"
$computername = Read-host "Enter the computer name."

#prompt for software app name"
#$product = Read-Host "Type the application name here."

#prompt for installer MSI"
$msiPath = Read-Host "Type the complete path to the installer MSI file"
#yes/no prompt to continue"
	
#$yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes",""
#$no = New-Object System.Management.Automation.Host.ChoiceDescription "&No",""
#$choices = [System.Management.Automation.Host.ChoiceDescription[]]($yes,$no)
#$caption = "Warning!"
#$message = "Do you want to proceed"
#$result = $Host.UI.PromptForChoice($caption,$message,$choices,0)
#if($result -eq 0) { Write-Host "You answered YES" }
#if($result -eq 1) { Write-Host "You answered NO" }
wmic
/node:$computername product call install true,"","$msiPath"

Open in new window


However tests runs show that once the script hits the WMIC line it just sits there.  So I figure I'm missing something, just no clue what it is.

the commented out section was me trying to include a Yes/No prompt.. disregard please.
0
Comment
Question by:Ben Hart
2 Comments
 
LVL 12

Accepted Solution

by:
larsrohr earned 250 total points
ID: 34220636
I'd say you need lines 21 and 22 concatenated:
wmic /node:$computername product call install true,"","$msiPath"

Putting "wmic" alone on a line simply opens up the wmic prompt, and you have no way to exit from that.
0
 
LVL 14

Author Comment

by:Ben Hart
ID: 34222232
/sigh

Feel like a tard hat.  thanks brah.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A procedure for exporting installed hotfix details of remote computers using powershell
Windows 10 came with  a lot of built in applications, Some organisations leave them there, some will control them using GPO's. This Article is useful for those who do not want to have any applications in their image (example:me).
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question