Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Running External Application

Reply
 
Old 04-25-2007   #1 (permalink)
Jonathan P


 
 

Running External Application

I am trying to get powershell to read an OU in AD and install a
program on each computer in that OU...i have it where it will show all the
computers in the OU and "connect" to them but the application gets executed
on all of them at once and doesnt work...i need to figure out how to stager
it i guess.

Maybe get it to where it runs on one and completes and then the next and
completes and then the next and completes....etc

My System SpecsSystem Spec
Old 04-25-2007   #2 (permalink)
IJuan


 
 

RE: Running External Application

You could create a loop that would check to see if the process you started is
still running. Something like this:

do {
Start-Sleep 20
} while ((Get-WMIObject -Query "SELECT * FROM Win32_Process WHERE Name =
'setup.exe'" -Computer $strComputer | Measure-Object).Count -gt 0)

You would have to replace "setup.exe" with what ever your install process
executable is and $strComputer with whatever variable you are using for the
computer name.

-= IJuan =-

"Jonathan P" wrote:

> I am trying to get powershell to read an OU in AD and install a
> program on each computer in that OU...i have it where it will show all the
> computers in the OU and "connect" to them but the application gets executed
> on all of them at once and doesnt work...i need to figure out how to stager
> it i guess.
>
> Maybe get it to where it runs on one and completes and then the next and
> completes and then the next and completes....etc

My System SpecsSystem Spec
Old 04-25-2007   #3 (permalink)
Brandon Shell


 
 

Re: Running External Application

What are you using to install remotely? Are you using start-process? If you
use psexec.exe it will just work as you requested. I do it all the time.

"Jonathan P" <JonathanP@discussions.microsoft.com> wrote in message
news:6C34236D-19C3-4D07-A677-5CEE2FFECA0A@microsoft.com...
>I am trying to get powershell to read an OU in AD and install a
> program on each computer in that OU...i have it where it will show all the
> computers in the OU and "connect" to them but the application gets
> executed
> on all of them at once and doesnt work...i need to figure out how to
> stager
> it i guess.
>
> Maybe get it to where it runs on one and completes and then the next and
> completes and then the next and completes....etc


My System SpecsSystem Spec
Old 04-25-2007   #4 (permalink)
Jonathan P


 
 

Re: Running External Application

psexec is what i would like to use but i couldnt get it to work...how do you
usually do it?



"Brandon Shell" wrote:

> What are you using to install remotely? Are you using start-process? If you
> use psexec.exe it will just work as you requested. I do it all the time.
>
> "Jonathan P" <JonathanP@discussions.microsoft.com> wrote in message
> news:6C34236D-19C3-4D07-A677-5CEE2FFECA0A@microsoft.com...
> >I am trying to get powershell to read an OU in AD and install a
> > program on each computer in that OU...i have it where it will show all the
> > computers in the OU and "connect" to them but the application gets
> > executed
> > on all of them at once and doesnt work...i need to figure out how to
> > stager
> > it i guess.
> >
> > Maybe get it to where it runs on one and completes and then the next and
> > completes and then the next and completes....etc

>
>

My System SpecsSystem Spec
Old 04-25-2007   #5 (permalink)
Brandon Shell


 
 

Re: Running External Application

I use something like. You can add any switches to the $cmd

function Install-Application {
Param([string]$srv,[string]$installer)
$PSExecPath = "c:\tools\psexec.exe"
$InstallCommandPath = "c:\tools"
$RemoteInstallPath = "c:\install"
$cmd = "$cmdPath \\$srv $LocalInstallPath\$installer"
Write-Host "Running $cmd on $srv"
if(test-Path \\$server\c$\install){
copy-Item "$InstallCommandPath\$installer" -destination
"\\$srv\$RemoteInstallPath\$installer"
invoke-Expression $cmd | out-Null
}
else{
New-Item -path \\$srv\c$ -name install -type directory | out-Null
copy-Item "$InstallCommandPath\$installer" -destination
"\\$srv\$RemoteInstallPath\$installer"
invoke-Expression $cmd | out-Null
}
}

"Jonathan P" <JonathanP@discussions.microsoft.com> wrote in message
news:00BA11E9-B812-4CAC-9892-3A2C8234B042@microsoft.com...
> psexec is what i would like to use but i couldnt get it to work...how do
> you
> usually do it?
>
>
>
> "Brandon Shell" wrote:
>
>> What are you using to install remotely? Are you using start-process? If
>> you
>> use psexec.exe it will just work as you requested. I do it all the time.
>>
>> "Jonathan P" <JonathanP@discussions.microsoft.com> wrote in message
>> news:6C34236D-19C3-4D07-A677-5CEE2FFECA0A@microsoft.com...
>> >I am trying to get powershell to read an OU in AD and install a
>> > program on each computer in that OU...i have it where it will show all
>> > the
>> > computers in the OU and "connect" to them but the application gets
>> > executed
>> > on all of them at once and doesnt work...i need to figure out how to
>> > stager
>> > it i guess.
>> >
>> > Maybe get it to where it runs on one and completes and then the next
>> > and
>> > completes and then the next and completes....etc

>>
>>


My System SpecsSystem Spec
Old 04-25-2007   #6 (permalink)
Brandon Shell


 
 

Re: Running External Application

btw... I miss typed
$RemoteInstallPath = "c:\install"
should be
$RemoteInstallPath = "c$\install"

"Brandon Shell" <tshell.mask@gmail.com> wrote in message
news:Ose8Qi3hHHA.4732@TK2MSFTNGP03.phx.gbl...
>I use something like. You can add any switches to the $cmd
>
> function Install-Application {
> Param([string]$srv,[string]$installer)
> $PSExecPath = "c:\tools\psexec.exe"
> $InstallCommandPath = "c:\tools"
> $RemoteInstallPath = "c:\install"
> $cmd = "$cmdPath \\$srv $LocalInstallPath\$installer"
> Write-Host "Running $cmd on $srv"
> if(test-Path \\$server\c$\install){
> copy-Item "$InstallCommandPath\$installer" -destination
> "\\$srv\$RemoteInstallPath\$installer"
> invoke-Expression $cmd | out-Null
> }
> else{
> New-Item -path \\$srv\c$ -name install -type directory | out-Null
> copy-Item "$InstallCommandPath\$installer" -destination
> "\\$srv\$RemoteInstallPath\$installer"
> invoke-Expression $cmd | out-Null
> }
> }
>
> "Jonathan P" <JonathanP@discussions.microsoft.com> wrote in message
> news:00BA11E9-B812-4CAC-9892-3A2C8234B042@microsoft.com...
>> psexec is what i would like to use but i couldnt get it to work...how do
>> you
>> usually do it?
>>
>>
>>
>> "Brandon Shell" wrote:
>>
>>> What are you using to install remotely? Are you using start-process? If
>>> you
>>> use psexec.exe it will just work as you requested. I do it all the time.
>>>
>>> "Jonathan P" <JonathanP@discussions.microsoft.com> wrote in message
>>> news:6C34236D-19C3-4D07-A677-5CEE2FFECA0A@microsoft.com...
>>> >I am trying to get powershell to read an OU in AD and install a
>>> > program on each computer in that OU...i have it where it will show all
>>> > the
>>> > computers in the OU and "connect" to them but the application gets
>>> > executed
>>> > on all of them at once and doesnt work...i need to figure out how to
>>> > stager
>>> > it i guess.
>>> >
>>> > Maybe get it to where it runs on one and completes and then the next
>>> > and
>>> > completes and then the next and completes....etc
>>>
>>>

>


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Problem running studio.net application in 64 Software
Can you run all 32 bit application in a 64 bit system running vista? General Discussion
Running Application in Login Script Vista security
Running older Application on Vista Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46