SnapinPack not deploying
-
Hi all,
I am having issues with a snapin pack deployment and I am not sure where to start troubleshooting any guidance would be appreciated.
First my server version
Wed Mar 29, 2017 14:10 pm
CentOS
Running Version 1.3.4
SVN Revision: 6066I am trying to use a PS script within a snapin pack. The script works fine outside of fog its just having issues when being called by fog I honestly cant even tell if the zip is downloading to the machine in the fog temp directory.
The client logs is below
------------------------------------------------------------------------------ ---------------------------------SnapinClient--------------------------------- ------------------------------------------------------------------------------ 3/29/2017 2:06 PM Client-Info Client Version: 0.11.9 3/29/2017 2:06 PM Client-Info Client OS: Windows 3/29/2017 2:06 PM Client-Info Server Version: 1.3.4 3/29/2017 2:06 PM Middleware::Response Success 3/29/2017 2:06 PM SnapinClient Snapin Found: 3/29/2017 2:06 PM SnapinClient ID: 106 3/29/2017 2:06 PM SnapinClient Name: PDQ 3/29/2017 2:06 PM SnapinClient Created: 2017-03-29 14:06:37 3/29/2017 2:06 PM SnapinClient Action: 3/29/2017 2:06 PM SnapinClient Pack: True 3/29/2017 2:06 PM SnapinClient Hide: False 3/29/2017 2:06 PM SnapinClient Server: 3/29/2017 2:06 PM SnapinClient TimeOut: 60 3/29/2017 2:06 PM SnapinClient SnapinPack File: powershell.exe 3/29/2017 2:06 PM SnapinClient SnapinPack Args: -ExecutionPolicy Bypass -File "[FOG_SNAPIN_PATH]\pdqman_deploy.ps1" -DeployComputerName "pdq-01" -Packagename "Fedline" 3/29/2017 2:06 PM SnapinClient File: pdqremote.zip 3/29/2017 2:06 PM Middleware::Communication Download: http://fogserver/fog/service/snapins.file.php?mac=18:A9:05:F5:60:9E||00:00:00:00:00:00:00:E0&taskid=106 3/29/2017 2:07 PM SnapinClient C:\Program Files\FOG\tmp\pdqremote.zip 3/29/2017 2:07 PM SnapinClient Processing SnapinPack pdqremote.zip 3/29/2017 2:07 PM SnapinClient Extracting SnapinPack 3/29/2017 2:07 PM SnapinClient Processing SnapinPack settings 3/29/2017 2:07 PM SnapinClient New SnapinPack File: powershell.exe 3/29/2017 2:07 PM SnapinClient New SnapinPack Args: -ExecutionPolicy Bypass -File "C:\Program Files\FOG\tmp\PDQ\pdqman_deploy.ps1" -DeployComputerName "pdq-01" -Packagename "Fedline" 3/29/2017 2:07 PM Bus { "self": true, "channel": "Notification", "data": "{\r\n \"title\": \"Installing PDQ\",\r\n \"message\": \"Please do not shutdown until this is completed\"\r\n}" } 3/29/2017 2:07 PM Bus Emmiting message on channel: Notification 3/29/2017 2:07 PM SnapinClient Starting snapin... 3/29/2017 2:07 PM SnapinClient Snapin finished 3/29/2017 2:07 PM SnapinClient Return Code: 0 3/29/2017 2:07 PM Bus { "self": true, "channel": "Notification", "data": "{\r\n \"title\": \"PDQ installed\",\r\n \"message\": \"Installation has finished and is now ready for use\"\r\n}" } 3/29/2017 2:07 PM Bus Emmiting message on channel: Notification 3/29/2017 2:07 PM Middleware::Communication URL: http://fogserver/fog/service/snapins.checkin.php?taskid=106&exitcode=0&mac=18:A9:05:F5:60:9E||00:00:00:00:00:00:00:E0&newService&json ------------------------------------------------------------------------------
Thank you for any help.
-
@Troye-Johnson you need to keep in mind snapins run as
SYSTEM
. This usually results in some permissions issues. I’d recommend debugging the script by making it log to some file such asC:\pdqman_deploy.txt
to ensure its running, and track down which command isn’t working. -
Yes I am aware it runs as system. The script has credentials embedded for network access, but it does not seem to even be making it that far is there a way for me to ensure the zip is being downloaded extracted and ran?
-
@Troye-Johnson said in SnapinPack not deploying:
Yes I am aware it runs as system. The script has credentials embedded for network access, but it does not seem to even be making it that far is there a wasy for me to ensure the zip is being downloaded extracted and ran?
Per my first post:
I’d recommend debugging the script by making it log to some file such as C:\pdqman_deploy.txt to ensure its running, and track down which command isn’t working.
-
Something strange is definitely going on I tried to send the same snapin to another computer and it changed my snapin here are the logs
The highlighted lines
was not how it was before. the thing is this time I actually was able to see the Zip file download and extract and attempt to run on the machine.
-
@Troye-Johnson I know I sound like I’m a broken record here, but have you attempted to have your pdq script itself dump to a log file, to see if it’s even being alled and the like?
Also, those " symbols are usually found to replace " in commands. Could attempt pulling them out and going to like ’ in your command, or perhaps using variables to call the relevant data instead?
-
Its ok Bob, but yes the pdq script it self does dump a script when it runs. The script it self can be run outside of the fog snapin feature flawlessly. by me logging into a machine locally not on the domain and running the script. the problem is the fog is not running the script and I cannot find logs to tell me why its not running correctly.
If it helps here is the script.
<# .SYNOPSIS Start a PDQ Deploy Deployment on a target machine .DESCRIPTION Trigger a PDQ Deploy deployment to start locally or on a remote machine with PDQ Deploy installed .EXAMPLE Start-Deployment -PackageName "Example Package" -Targets "Wolverine" .EXAMPLE Start-Deployment -ScheduleName "Example Schedule" -Targets "Wolverine" .EXAMPLE Start-Deployment -ScheduleID 123 -Targets "Wolverine" .PARAMETER DeployComputerName The machine with PDQ Deploy installed. This defaults to the local machine .PARAMETER PackageName The names of packages on DeployMachine that you wish to use .PARAMETER ScheduleName The names of schedules on DeployMachine that you wish to use .PARAMETER ScheduleID The schedule IDs on DeployMachine that you wish to use .PARAMETER Targets A list of targets that you wish to deploy a package or schedule to. Leave blank if you wish to target the local machine. #> [cmdletbinding( SupportsShouldProcess = $True )] Param( [String]$DeployComputerName = $env:COMPUTERNAME, [Parameter(ParameterSetName = "Package")] [string]$PackageName, [Parameter(ParameterSetName = "Package")] [String[]]$Targets = $env:COMPUTERNAME, [Parameter(ParameterSetName = "Schedule")] [string]$ScheduleName, [Parameter(ParameterSetName = "ScheduleID")] [Int]$ScheduleID ) Process { # Add parameters to a hashtable to easily push into invoke-command as an argument $MyParameters = @{ DeployComputerName = $DeployComputerName PackageName = $PackageName Targets = $Targets ScheduleName = $ScheduleName ScheduleID = $ScheduleID DeploymentType = $PSCmdlet.ParameterSetName } #OS Check $PSScriptRoot = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition #Credentials $User = "pdqtest" $PasswordFile = "$PSScriptRoot\Password.txt" $KeyFile = "$PSScriptRoot\AES.key" $key = Get-Content $KeyFile $MyCredential = New-Object -TypeName System.Management.Automation.PSCredential ` -ArgumentList $User, (Get-Content $PasswordFile | ConvertTo-SecureString -Key $key) # This outputs a powershell.log to the root directory of the target machine $MyParameters | Out-String | Out-File C:\powershell.log # Testing to see if PSRemoting is enabled If (Test-WSMan -ComputerName $DeployComputerName) { Write-Verbose "Test-WSMan test passed on $DeployComputerName" # Added -Whatif capability to script If ( $PSCmdlet.ShouldProcess($DeployComputerName, "Starting deployment with the following parameters:`n $($MyParameters | Out-String)") ) { # Connect to Deploy machine and attempts to start a deployment Invoke-Command -ComputerName $DeployComputerName -credential $MyCredential -ArgumentList ($MyParameters) -ScriptBlock { Param ($MyParameters) # This outputs a powershell.log to the root directory of the deploy machine $MyParameters | Out-String | Out-File C:\powershell.log # Build command string based on deployment type Switch ($MyParameters.DeploymentType) { "Package" { $PDQDeployCommand = "pdqdeploy deploy -package ""$($MyParameters.PackageName)"" -targets $($MyParameters.Targets)" } "Schedule" { $DB = "$env:ProgramData\Admin Arsenal\PDQ Deploy\Database.db" $SQL = "SELECT ScheduleID FROM Schedules WHERE Name = '$($MyParameters.ScheduleName)' COLLATE NOCASE;" $ScheduleID = $SQL | sqlite3.exe $db $PDQDeployCommand = "pdqdeploy StartSchedule -ScheduleId $ScheduleID" } "ScheduleID" { $PDQDeployCommand = "pdqdeploy StartSchedule -ScheduleId $($MyParameters.ScheduleID)" } } # Append the actual command that will be run to powershell.log "Invoke-command: $PDQDeployCommand" | Out-File C:\powershell.log -Append # Create and invoke scriptblock $PDQDeployCommand = [ScriptBlock]::Create($PDQDeployCommand) $PDQDeployCommand.Invoke() } } } } }
While it may say the script successfully it didn’t actually run.
-
Good news this morning I rebooted the server gave it another try and it all worked.