This project is read-only.

Using the App Deployment Toolkit against remote computers

Topics: Archive - General
Aug 21, 2013 at 5:28 PM
Edited Aug 23, 2013 at 3:23 PM
I have been experimenting with this toolkit in a test environment and am pretty impressed. I need some help though with running the script against target computers. My first test is to install Java 7u25.

In the Deploy-Application.ps1 script I simply added in (under the # "INSTALLATION"):

Start-Process "C:\Test\jre-xxx.exe"

If I run the script on the local computer, the Java installation window pops up. I will work with switches later, but want to make sure I can run this on remote boxes first. I currently use PsExec to install third party software, and have been told we need to remove it from all servers/workstations in the near future.

So, I have been trying to figure out how to deploy apps remotely with powershell and came across this script. We have a 2008R2 / Windows 7 environment. I would like to run this script against a text file containing a list of workstations, like I can with PsExec. But, before I can get to this step, I can not get the script to run on even one remote workstation. The commands I am using:

Invoke-Command -Computername Win8-1 -FilePath .\Deploy-Application.ps1

The test environment is Server 2012R2/Windows 8, Remote management is enabled. The error I am getting is:

.......

Illegal characters in path.
  • CategoryInfo : InvalidArgument: ( Pre-Install, I...===============:String) [Split-Path], ArgumentException
  • FullyQualifiedErrorId : ItemExistsArgumentError,Microsoft.PowerShell.Commands.SplitPathCommand
  • PSComputerName : win8-1
The term 'Write-Log' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
  • CategoryInfo : ObjectNotFound: (Write-Log:String) [], CommandNotFoundException
  • FullyQualifiedErrorId : CommandNotFoundException
  • PSComputerName : win8-1
The term 'Exit-Script' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
  • CategoryInfo : ObjectNotFound: (Exit-Script:String) [], CommandNotFoundException
  • FullyQualifiedErrorId : CommandNotFoundException
  • PSComputerName : win8-1

If anyone can help out with some guidance I'd greatly appreciate it. I'm sure it will be helpful to many other administrators as well!
Coordinator
Aug 24, 2013 at 1:02 PM
The Toolkit won't work with remote execution. We don't have any plans to support it either, because most people would be using some sort of software distribution tool, like SCCM to run the Deloy-Application script on machines.

When you run Invoke-Command with the -FilePath switch, the script is copied to the remote machine, executed there and the result returned to the executing machine. The Deplloy-Application dot-sources the AppDeloyToolkitMain script and expects it to be in the AppDeloyToolkit subdirectory, but this file doesn't get copied to the remote machine using Invoke-Command, so the script will fail.

I believe you can enter a PS session and dot source a script remotely:
http://windowsitpro.com/blog/guest-column-dude-wheres-my-profile

However, there is still a problem - not only does the Deploy-Application script expect the AppDeployToolkitMain script in a subdirectory, but also the XML configuration file and the PNG and ICO files. So, the Toolkit is not well suited to remote execution, it really needs to be executed locally on the machine.

Your best bet is to run a command to copy all of the required files to the remote machine and try to execute the Deloy-Application script remotely. You may have to use the -ScriptBlock switch instead of the -FilePath switch to point to the remotely located Deploy-Application script, as the FilePath switch is likely to copy the script to a temporary directory where again it won't find the required toolkit files.

Let us know how you get on.

Seán

PS, I recommend using the Execute-Process function included with the toolkit instead of the Start-Process cmdlet to execute this command:

Start-Process "C:\Test\jre-xxx.exe"

You'll find examples in the documentation.
Aug 26, 2013 at 7:48 PM
Thanks for the reply,

Unfortunately we do not have SCCM, if I did I don't think I'd be needing a script for this. But I understand, and appreciate the tips. I'll keep on working on a resolution.