Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hello, Maybe someone can assist

Status
Not open for further replies.

DarkOne72

Technical User
Jun 14, 2002
210
US
Hello,

Maybe someone can assist me in getting this script to work.
What I want this to do is when ran it will read a list of computers from a text file "computers.txt" and invoke/run a file from a shared location and install it on those machines listed in the text file.

Code:
$cred = get-credential
 $exe = "\\jashare1\IT\CitrixOnlinePluginWeb.exe"
 $computers = get-content "C:\Scripts\Computers.txt"
 foreach($computer in $computers)
 {
     Invoke-WmiMethod -Name Create -Class Win32_Process -Namespace root\cimv2 -ArgumentList $exe -credential $cred -ComputerName $computer | out-null
 }

thanks in advance
 
I run it and it prompts for the credentials (a popup window with username and password) to which I supply and acts liek it runs but nothing happens.
It never installs but says DONE.
The credentials are correct and an administrator.
 
It says "Executing Script" for about 3 seconds then says "Script Execution Completed."
So it doesn't error out but it doesn't DO anything either.
 
I get this after removing the |Out Null:
__SERVER :
__NAMESPACE :
__PATH :
ProcessId :
ReturnValue : 2


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top