Retrieve the WPSADM Password through BAT Script
I used the below command in PowerShell to retrieve the WPSADM password of a computer.
@Jason Li .exe -Command "Get-QADComputer -proxy -SearchRoot "DC=domain,DC=com" -SearchScope Subtree -DontUseDefaultIncludedProperties -IncludedProperties name,ms-Mcs-AdmPwd "hostname" | select ms-Mcs-AdmPwd
But when converted the above to a batch script like below is not give any output and the Command window is getting closed.
set /p hostname=
for /f %%I in ('@Jason Li .exe -Command "Get-QADComputer -proxy -SearchRoot "DC=domain,DC=com" -SearchScope Subtree -DontUseDefaultIncludedProperties -IncludedProperties name,ms-Mcs-AdmPwd "%hostname%" | select ms-Mcs-AdmPwd"') do set "pwd=%%I"
setlocal EnableDelayedExpansion
echo %pwd%
The expected output of the script is: The WPSADM password of the %hostname% is: %pwd%
The above command will work only with Dell Active Roles. Could anyone help me to get the WPSADM Password through BAT Script?