Deploy: run Powershell script from PDQDeploy server?

Comments

6 comments

  • Colby Bouma

    Unfortunately, that isn't possible in Deploy.

    However, an Inventory Tool set to a Run Type of Local should work: https://link.pdq.com/docs-PDQInventory?creatingtools.htm

    1
    Comment actions Permalink
  • Michael Yorke

    Colby Bouma, thanks! As an alternative, I guess I could push out the powershell module when deploying the LAPS client to the endpoints, then execute the command locally on the endpoints, correct?

    1
    Comment actions Permalink
  • Colby Bouma

    I believe so, but I've never set up LAPS before, so I can't say for sure.

    0
    Comment actions Permalink
  • Michael Yorke

    Colby Bouma, thanks again. That worked! I'll post my findings here for anyone else who is looking to do this...

    I re-deployed the LAPS client using 

    msiexec.exe /i "LAPS.x64.msi" ALLUSERS=1 /qn /norestart /log output.log ADDLOCAL=CSE,Management.PS

    The ADDLOCAL bit specifies which components to install, CSE is for the GPO Client Side Extension (this is installed by default if you don't inlcude the ADDLOCAL parameter) and Management.PS is the powershell module. 

    I then have another package which simply forces a reset of the LAPS password.

    Step 1 (Powershell):

    Reset-AdmPwdPassword -ComputerName $env:COMPUTERNAME

    Step 2 (command):

    gpupdate /force

    Step 1 expires the password immediately. Step 2 runs the CSE and forces the password to reset and write this back to the Active Directory.

    I then tried to create a PDQ Inventory Tool as Colby Bouma suggested. I created the tool using a powershell command to run. This is a Local tool (runas Console user).

    Reset-AdmPwdPassword -ComputerName $(Computer:TARGET)
    PsExec -accepteula \\$(Computer:TARGETHOSTNAME) Gpupdate /target:computer

    The reset-AdmPwdPassword bit works. However, I'm getting an error regarding psexec...

    PsExec : The term 'PsExec' is not recognized as the name of a cmdlet, function, script file, or operable program

    This is installed in C:\windows\system32\psexec.exe on the PDQ central server, so not sure why I'm getting this error. Can you help?

    0
    Comment actions Permalink
  • Colby Bouma

    Are you running that Tool from a Client? If so, you will need to install PsExec on it too.

    0
    Comment actions Permalink
  • Michael Yorke

    I'm trying to follow your suggestion and create a tool. https://help.pdq.com/hc/en-us/community/posts/4411254123931/comments/4411284728347

    The tool is set to Local, which I understood to mean it would run on the PDQ central server. I have re-read the documentation and now understand Local to mean the computer running PDQ Deploy console, which is my local PC, not the PDQ server. This now makes sense as I didn't have psexec on my local PC. I do now, and the tool is working well!

    Many thanks.

    0
    Comment actions Permalink

Please sign in to leave a comment.