- Save the first script as .cmd or with .bat extension.
- Save the Secound script as .PS1 extension.
- Both the scripts should be saved in the same location ,C:\temp\HWID. Then trigger the .cmd file which will call the PS1.
Batch File
@Echo off
PowerShell.exe -NoProfile -Command "& {Start-Process PowerShell.exe -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File C:\temp\HWID\Hash_Script.ps1' -Verb RunAs}"
Powershell Script
$serialnumber = Get-WmiObject win32_bios | select Serialnumber
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Script -Name Get-WindowsAutoPilotInfo -Force
Set-ExecutionPolicy Unrestricted -Force
Get-WindowsAutoPilotInfo -Outputfile c:\temp\HWID\$($serialnumber.SerialNumber)-Hash.csv
No comments:
Post a Comment