Jul 05 2018 05:31 AM - edited Nov 08 2019 02:08 AM
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 a USB Drive with the following :
Plug in the USB Drive..
Right Click the file ..GetAutoPilot.cmd and (run as Administrator) (it seems everytime I plug in the USB I get D: Drive but with the updated command below its automatic )
Prepare Files
1) GetAutoPilot.cmd
2) Download a copy of Get-WindowsAutoPilotInfo.ps1
Contents of GetAutoPilot.cmd
PowerShell -NoProfile -ExecutionPolicy Unrestricted -Command %~d0\Get-WindowsAutoPilotInfo.ps1 -ComputerName $env:computername -OutputFile %~d0\computers.csv -append
Get-WindowsAutoPilotInfo.ps1 - downloaded from powershellgallery
https://www.powershellgallery.com/packages/Get-WindowsAutoPilotInfo/1.6
What it does...
It quickly dumps the CSV file onto the USB Drive and now I have all the CSV Files that I need in one file ready to upload to intune.
Then unplug and move onto the next device ...
Easy !
Simon Allison
Jan 08 2019 10:11 PM
Apr 18 2019 10:15 AM
Nov 04 2019 04:59 PM
@mac-e updated! thanks makes it even easier
Nov 05 2019 01:52 PM
@Simon Allison - do you have a link to the files that I can put onto a usb stick please? struggling to get this to work... ta
Nov 07 2019 01:04 PM
@firebladez Try these, put them on the USB stick
I did run them with the OS installed and through OOBE stage you can get to the command prompt by pressing , press Shift + F10
I have put them here...
https://github.com/simonallisonuk/Scripts
Nov 07 2019 04:59 PM
Thanks @Simon Allison - I'll give it a go today... :)
Nov 08 2019 02:07 AM
I have just tested and there is an error, but this one works - all I did was remove the "p" as this gives the path and not just the drive. updating scripts
@ECHO ON
PowerShell -NoProfile -ExecutionPolicy Unrestricted -Command %~d0\Get-WindowsAutoPilotInfo.ps1 -ComputerName $env:computername -OutputFile %~d0\$env:computername.csv
Nov 10 2019 07:55 AM
@Simon Allison Hi was having difficulty getting info in the computers.csv but ran Winrm quickconfig.
Now I get "default String" under device serial no. : nothing in windows ; and a very long string of letters under hardware hash. No column for computer name.
Any thoughts?
Nov 10 2019 04:47 PM
hi @Simon Allison - sorry could not get this to work - after running the cmd as admin it had a heap of error then the powershell page closed - it was something like, the client can not connect to the destination specified in the request - and you can not call a method on a null-valued expression... this is what I managed to get from the quick vid I got on my phone
Jan 03 2020 06:17 AM
@firebladezI had to run the following in an elevated CMD prompt:
winrm quickconfig
That fixed the mass of red being thrown back from the PS script. Hope this helps you
Feb 13 2020 01:52 AM
Hello, thanks for the tip.
I have added the following command on the cmd as it does not work if Windows management service is disabled and it was on my machines :
net start WManSvc
Thanks,
Yohan.
Sep 01 2020 12:58 AM
The problem where i ran into was that you cannot run the Script when you are in a Public Network.
you need to change it to Private.
Then it runs ok.
Thanks alot. :)
Nov 09 2020 07:44 AM
@Simon Allison Do you know if it's possible to use this without completing Windows setup. ie During OOBE after networking has been setup?
Dec 15 2020 01:12 AM
@Andycap147 the whole process was designed that I know of to run under OOBE, you cant do it on pre-existing setups as it was all designed to run out of the box on new surface devices, as in the background and permissions, and apps etc are from Azure AD and Intune.
I was looking for the same setup where you could use pre-existing windows setups, but sadly it wasnt the case, as you would loose all existing apps.
sorry for the late reply
May 20 2021 02:49 AM
I can't get this to run... but if i run the get-windowsautopilot.ps1 manually, it works fine so something in that cmd file is not running for me. i can type them line by line and it works up to opening powershell but that's it. after i've opened up powershell from the cmd prompt, then i'm stuck and i can't get the last bit of your code working.
May 20 2021 02:52 AM
Oct 21 2021 11:00 AM
Instead of
PowerShell -NoProfile -ExecutionPolicy Unrestricted -Command %~dp0\Get-WindowsAutoPilotInfo.ps1 -ComputerName $env:computername -OutputFile %~dp0\computers.csv -append,
Leave out the -ComputerName variable:
PowerShell -NoProfile -ExecutionPolicy Unrestricted -Command %~dp0\Get-WindowsAutoPilotInfo.ps1 -OutputFile %~dp0\computers.csv -append
This defaults the script to localhost, which is what the script sees (I believe) in the OOB screen. Either way, it works.
Dec 30 2021 01:59 AM
Mar 03 2022 08:47 PM - edited Mar 03 2022 08:48 PM
@Andycap147 Yes, pressing Caps+F10