Help extending Reset Secure channel script
So, following on from the PDQ&A last week, I was quite interested in the Reset Secure channel script.
Obviously, it needs to be run as the local administrator, and its here I hit a problem. We run LAPS to randomize the local admin password frequently and store that in AD (If you're not already using it, it's well worth looking into - Totally free too).
Now, there's a powershell module for Laps, so it should be as simple as:
#Import the LAPS module
#Get LocalAdmin password of computer
$pwd = Get-AdmPwdPassword -ComputerName $ComputerName
That's going to retrieve the local admin password of the machine and allow us to use the $pwd variable in the reset secure channel script
Test-ComputerSecureChannel -Repair -Credential $pwd
PDQ is going to run all that from the client, which won't work.
What I need to do, is pass the computername Variable from PDQ to the script, run the first half ON the PDQ machine to retrieve the password, then pass the variable to the PDQ Deployment.