Windows Vista Forums

Running External Application
  1. #1


    Jonathan P Guest

    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

  2. #2


    IJuan Guest

    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

  3. #3


    Brandon Shell Guest

    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

  4. #4


    Jonathan P Guest

    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

  5. #5


    Brandon Shell Guest

    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

  6. #6


    Brandon Shell Guest

    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

Running External Application problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can you run all 32 bit application in a 64 bit system running vista? kakkalo General Discussion 11 03 Jan 2009
Winfast DVT Application stops running eszry Vista hardware & devices 0 03 Jan 2009
Running Application in Login Script Jeff Belorit Vista security 3 04 Mar 2008
Running older Application on Vista Zeba Vista General 5 14 Jan 2008
Running WPF application on vista dnintzel Avalon 1 18 Feb 2006