Forum Discussion
SimonAllison
Jul 05, 2018Iron Contributor
Get-WindowsAutoPilotInfo - A quicker way...
Hi All Just a Tip from me to make it easier (if you got other ways, let me know, would be interested) Starting to deploy via Autopilot but first grabbing the information - so I am using ...
davewilliamson
May 11, 2022Copper Contributor
I am using the following .cmd and it runs perfectly. I just wanted to extract the computer name as the title instead of compHash.csv in other words if the machine is called desktop001 it would save as desktop001.csv.
@ECHO OFF
echo Enabling WinRM
PowerShell -NoProfile -ExecutionPolicy Unrestricted -Command Enable-PSRemoting -SkipNetworkProfileCheck -Force
echo Gathering AutoPilot Hash
PowerShell -NoProfile -ExecutionPolicy Unrestricted -Command %~dp0Get-WindowsAutoPilotInfo.ps1 -ComputerName $env:computername -OutputFile %~dp0compHash.csv -append
echo Done!
pause
any idea of the slight amendment i'd need to make ?
Help would be appreciated.
@ECHO OFF
echo Enabling WinRM
PowerShell -NoProfile -ExecutionPolicy Unrestricted -Command Enable-PSRemoting -SkipNetworkProfileCheck -Force
echo Gathering AutoPilot Hash
PowerShell -NoProfile -ExecutionPolicy Unrestricted -Command %~dp0Get-WindowsAutoPilotInfo.ps1 -ComputerName $env:computername -OutputFile %~dp0compHash.csv -append
echo Done!
pause
any idea of the slight amendment i'd need to make ?
Help would be appreciated.
SimonAllison
May 17, 2022Iron Contributor
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
- davewilliamsonMay 18, 2022Copper ContributorSo thanks for your reply Simon, I have tried this before but it stops the hash recovery and creates a blank .csv with the title of computers.csv. Thanks for your help though, its not a massive problem it just would have been nice to have the title as either the serial or computer name.
- 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