PDQ command line: args outside of script (PRTG > PDQ)

Comments

2 comments

  • Colby Bouma

    You can use a param block to pass data into a PowerShell script when you call it.

    [CmdletBinding()]
    param (
    [Parameter(Mandatory = $true)]
    [String]$Package,

    [Parameter(Mandatory = $true)]
    [String]$PdqServer,

    [String[]]$Target = $env:COMPUTERNAME
    )

    Invoke-Command -ComputerName $PdqServer -ScriptBlock {PDQDeploy.exe Deploy -Package $Using:Package -Targets $Using:Target}

    Here's a couple examples of calling this script:

    & .\Example.ps1 -Package 'Wake Up' -PdqServer prtgserver.domain.co.uk -Target %host
    & .\Example.ps1 -Package 'Wake Up' -PdqServer prtgserver.domain.co.uk -Target PC1, PC2, PC3
    0
    Comment actions Permalink
  • Michael Yorke

    Amazing! Thanks Colby. This works perfectly when testing on its own. It doesn't work in PRTG - so I need to take it up with them and see what's happening and try to get the logs.

    I'll post back here with a solution.

     

    0
    Comment actions Permalink

Please sign in to leave a comment.