View Single Post
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