Test A Deployment Outside of PDQ Deploy (with PowerShell)

4/26/2018 3826 Contributors

You wish to check to ensure deployments work outside of the PDQ Deploy program. This can be useful in troubleshooting a myriad of possible issues.

In order to perform this test, the following prerequisites are required:

1. Download the Visio Viewer 2010 package in PDQ Deploy.
PowerShell (WMF) 4.0+ on both the PDQ console and the target must be installed.
3. PS Remoting must be enabled. Open PowerShell on the target and run the following command:

Enable-PSRemoting -Force

4.  The user context from which you are running the PowerShell ISE from must have permissions to install software on the target machine. It must also be able to write to the ADMIN$ of the target.

1. Search for ISE, right-click, and "Run as administrator"
2. Copy the script block into the ISE (we’ve included the script block at the bottom of this article as well).

#Requires -RunAsAdministrator
$ErrorActionPreference = "SilentlyContinue"
#Define your target machine#
$Target = "YourTargetHere"
#Define the source of your exe, by default PDQ uses C:\Users\Public\Documents\Admin Arsenal\Repository#

$Source = "Path\to\Repository\Microsoft\Visio Viewer 2010\visioviewer.exe"
$Destination = "\\$Target\ADMIN$\AdminArsenal"
$Credentials = Get-Credential

Copy-Item -Path "$Source" -Destination "$Destination" -Force
Invoke-Command -ComputerName $Target -Credential $Credentials -ScriptBlock {
    #Define your silent switches use "`" as the escape character
    $SilentSwitch = "`/quiet `/norestart"
    #This is the same destination as above
    $Destination = "\\$($Using:Target)\ADMIN$\AdminArsenal"

    Start-Process "$($Using:Destination)\visioviewer.exe" -ArgumentList $SilentSwitch -Wait

3. Change two variables, $Target and $Source in the ISE:
4. Press F5 to run the script (the ISE is the active window).

5. You will be prompted for credentials when running the script. The credentials are those used to install the software remotely.

6. This will perform the following (this can take several minutes):

  • Copy over the Visio Viewer 2010 executable to \\$Target\ADMIN$\AdminArsenal\
  • Execute the executable using the silent parameters to install Visio Viewer 2010
  • The ISE will then record any errors (success is the absence of errors).

7. Check the target machine to ensure that Visio Viewer 2010 is installed.

Uninstall Visio Viewer 2010 After the Test
1. Copy the following into the PowerShell ISE

#Requires -RunAsAdministrator
$ErrorActionPreference = "SilentlyContinue"
#Target to uninstall Visio Viewer from
$Target = "D7-SUP-LAB"

Invoke-Command -ComputerName $Target -ScriptBlock {
    Remove-Item "\\$env:COMPUTERNAME\ADMIN$\AdminArsenal\visioviewer.exe" -Force
    Start-Process "$env:SystemRoot\System32\MsiExec.exe" -ArgumentList "/qn /norestart /X{95140000-0052-0409-0000-0000000FF1CE}"

2. Change the $Target variable to the same target you deployed Visio Viewer 2010 to:
3. Press F5 to run the script (the ISE is the active window).

4. Confirm Visio Viewer 2010 is uninstalled on the target machine.

See Also:
Create A Zero-Impact Package To Test Deployments & Schedules