Invoke PDQ Deploy Powershell Deployment with specific Credentials


1 comment

  • Kris Powell

    Hello there!

    Since it sounds like you're running PowerShell to connect to a machine that you have PDQ Deploy installed on, I'll focus on the PowerShell.

    PowerShell's Invoke-Command has a -Credential parameter that accepts a PSCredential object. Check out the docs on it here: Invoke-Command

    So, if you're trying to run a scriptblock remotely on a different computer as a different user, you'll just need to provide the credential for that different user.

    There are a handful of ways that you can create a PSCredential object. If you're just interactively using PowerShell, the easiest way to do that is to use the Get-Credential cmdlet and store the resulting object into a variable:

    $MyCredential = Get-Credential 

    That will prompt you for a username and password and will create the PSCredential object for you. Then, you can use that new credential directly with Invoke-Command. Combining the above with your example:

    $MyCredential = Get-Credential 
    Invoke-Command -ComputerName "Fry" -Credential $MyCredential -ScriptBlock 
    pdqdeploy Deploy -Package "Example Package" -Targets "Wolverine"

    If you're looking for more info on credentials and how to securely use them, take a look at my blogs I wrote on the topic:

    I hope that helps! Best of luck to you!


    Comment actions Permalink

Please sign in to leave a comment.