Forum Discussion
Get-WindowsAutoPilotInfo - A quicker way...
your code is missing the slashes : (Copy and paste issue?)
example:
-OutputFile %~dp0compHash.csv -append
My script:
-OutputFile %~d0\computers.csv -append
It should output the computer name , hope this helps
- mdmcq5May 24, 2022Copper Contributor
davewilliamson I've found that HP systems don't like %~dp0compHash.csv but if I use "compHash.csv it works. Dell doesn't have any issues running %~dp0compHash.csv
- SimonAllisonMay 24, 2022Iron ContributorThanks mdmcq5 and @davidwilliamson for your input, yes I was originally ran on Dell, if I had a HP Laptop to hand I would have found the issue, so are you saying here just using compHash.csv works for both types of device? I dont have a system to test on to try it, thanks in advance
- mdmcq5May 24, 2022Copper Contributor
SimonAllison this code didn't work for me on HP:
PowerShell -NoProfile -ExecutionPolicy Unrestricted -Command %~dp0Get-WindowsAutoPilotInfo.ps1 -ComputerName $env:computername -OutputFile %~dp0compHash.csv -append
so I just removed all the %~dp0 references, I also don't think either could define ComputerName $env:computername. I ran the below w/out any issues on both Dell and HP
PowerShell -NoProfile -ExecutionPolicy Unrestricted -Command Get-WindowsAutoPilotInfo.ps1 - -OutputFile compHash.csv -append
But for non-OOBE boxes, there's a new CIM error being thrown:
Get-CimInstance : A general error occurred that is not covered by a more specific error code.
At D:\Autopilot\Get-WindowsAutoPilotInfo.ps1:209 char:23
... evDetail = (Get-CimInstance -CimSession $session -Namespace root/cimv
the error is due to new KB5013942 or KB5011831Once the KB(s) is uninstalled, the code runs. For me on W10 21H2 it was KB5013942. I have no idea if MS knows their update caused an issue or if there's a fix in the pipeline.