How do we set PurchaseOrderId using Get-WindowsAutoPilotInfo.ps1

Copper Contributor

We would like to use intune to manage all our existing and new Windows computers. We have several offices and today we use different computer configuration policies for different locations. Today, we do this by assigning a standard prefix to the computer name (e.g. OSL for Oslo, PAR for Paris). We are unable to figure out how to achieve this using intune. We are aware that in intune we can create a Dynamic security group with rule = device.devicePhysicalIDs -any _ -contains “[ZTDId]” and assign an Autopilot profile to that group, but this doesn't allow us to group devices located in different offices (we can use the computer naming template, but then the same prefix is applied on all the computers). We are now thinking if we can set a specific PurchaseOrderId when we collect device information using Get-WindowsAutoPilotInfo.ps1 (different for each office), so that we can create dynamic groups and have separate autopilot profiles for each office. How to set a PurchaseOrderId when csv file is created?

6 Replies

Hi Rajesh,


that's pretty simple just add ",Order ID" in the header row and append your custom Order ID ",MyOrderID" at the end of a device entry row. Simplified example to make it more clear:


Device Serial Number,Windows Product ID,Hardware Hash,Order ID




Hi Oliver,

This requires opening the CSV file and adding the order id to the end of the file and also modifying or removing the header, we have tried and this and it works. But this is not practical for us, we are planning to use Windows Configuration Packages on USB drive to pre-configure the device and fetch the CSV file (to be executed by remote non-IT users), we are capturing the CSV file via Azure storage account. We would like to automate the adding of order id, we are able to do this by using our own PowerShell script, but we are wondering if we can pass an additional parameter to Get-WindowsAutoPilotInfo.ps1 script to add the order id, looks this is not possible at the moment.

Best regards,

Rajesh Khanikar

Correct there is no support in the script at the moment but you can easily modify and extend the script to support it. Then you can target group of devices with different OrderIDs to accomplish your goal. Just add a new parameter in the beginning of the script and add this new variable to the custom ps object and modify the csv output to include ",Order ID". Pretty straight forward :thumbs_up:

@Oliver Kieselbach Hi Oliver, you say to use (or add) the OrderID column in the Autopilot CSV file, however this is used as a tag. According to a few articles Ive seen there is also a PurchaseOrderID colum that can be added to the CSV. However I can not get this to work.

On one technet article it says this can only be set by OEM. Is this true?

Hi @Ewan Monro,


no, OrderID can also be set by adding it to the csv file for import. This OrderID field is then mapped to to Group Tag in the Intune Portal :-). This is what you can modify and use later for AAD dynamic grouping.


to import with a custom Order ID use a csv like this:


Device Serial Number,Windows Product ID,Hardware Hash,Order ID


it will result in something like this:






@Ewan Monro 


We have the same issue.  It appears that PurchaseOrderID is a closely guarded secret and the only work around I have seen online is to cheat and use OrderId (Group Tag) and shove multiple items in to it so that you can do muliple things.

Example.  AADUserJoined-Accounting