Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Initiating WMIC from within a Powershell Script

Posted on 2010-11-26
2
Medium Priority
?
663 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 12

Accepted Solution

by:
larsrohr earned 1000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
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…

688 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