Running the script
The very last step in the script process is invoking the Windows server scanning script. You will need to ensure that you have the answer file in the same directory as the script. You will also want to make sure that you keep a copy of the answer file, because the Windows server scanning script will remove the answer file after execution.
To execute the Windows server scanning script from a command line, you can perform the following:
powershell.exe -executionPolicy bypass -noexit -file"c:\temp\ScanningScript.ps1" "AAZwAmAE4AMgAoAFEAVAAhAFAA"
The output of this is shown in the following screenshot:

In this example, you successfully launch the Windows server scanning script:
You first start by calling the
powershell.exeexecutable from an elevated command prompt.You bypass the PowerShell execution policy by leveraging the
-executionPolicyparameter with thebypassargument.You then leverage the
-noexitparameter to ensure that the PowerShell session doesn't exit after execution...