Solved

Initiating WMIC from within a Powershell Script

Posted on 2010-11-26
2
648 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Hi all.   The other day I had to change the passwords for a bunch of users on the fly. Because they were so many, I decided to do it in an automated way and I would like to share it with you all.   If you are not doing it directly in a Domain Co…
How to sign a powershell script so you can prevent tampering, and only allow users to run authorised Powershell scripts
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.

910 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now