Home

How do we set PurchaseOrderId using Get-WindowsAutoPilotInfo.ps1

%3CLINGO-SUB%20id%3D%22lingo-sub-269221%22%20slang%3D%22en-US%22%3EHow%20do%20we%20set%20PurchaseOrderId%20using%20Get-WindowsAutoPilotInfo.ps1%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-269221%22%20slang%3D%22en-US%22%3E%3CP%3EWe%20would%20like%20to%20use%20intune%20to%20manage%20all%20our%20existing%20and%20new%20Windows%20computers.%20We%20have%20several%20offices%20and%20today%20we%20use%20different%20computer%20configuration%20policies%20for%20different%20locations.%20Today%2C%20we%20do%20this%20by%20assigning%20a%20standard%20prefix%20to%20the%20computer%20name%20(e.g.%20OSL%20for%20Oslo%2C%20PAR%20for%20Paris).%20We%20are%20unable%20to%20figure%20out%20how%20to%20achieve%20this%20using%20intune.%20We%26nbsp%3Bare%20aware%20that%20in%26nbsp%3Bintune%20we%20can%20create%20a%20Dynamic%20security%20group%20with%20rule%20%3D%20device.devicePhysicalIDs%20-any%20_%20-contains%20%E2%80%9C%5BZTDId%5D%E2%80%9D%20and%20assign%20an%20Autopilot%20profile%20to%20that%20group%2C%20but%26nbsp%3Bthis%20doesn't%20allow%20us%20to%26nbsp%3Bgroup%20devices%20located%20in%20different%20offices%20(we%20can%20use%20the%20computer%20naming%20template%2C%20but%20then%20the%20same%20prefix%20is%20applied%20on%20all%20the%20computers).%20We%20are%20now%20thinking%20if%20we%20can%20set%20a%20specific%20PurchaseOrderId%20when%20we%20collect%20device%20information%20using%26nbsp%3BGet-WindowsAutoPilotInfo.ps1%20(different%20for%20each%20office)%2C%20so%20that%20we%20can%20create%20dynamic%20groups%20and%20have%20separate%20autopilot%20profiles%20for%20each%26nbsp%3Boffice.%20How%20to%20set%20a%26nbsp%3BPurchaseOrderId%20when%20csv%26nbsp%3Bfile%20is%20created%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-269221%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EIntune%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-393621%22%20slang%3D%22en-US%22%3ERe%3A%20How%20do%20we%20set%20PurchaseOrderId%20using%20Get-WindowsAutoPilotInfo.ps1%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-393621%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F224488%22%20target%3D%22_blank%22%3E%40Ewan%20Monro%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Eno%2C%20OrderID%20can%20also%20be%20set%20by%20adding%20it%20to%20the%20csv%20file%20for%20import.%20This%20OrderID%20field%20is%20then%20mapped%20to%20to%20%3CSTRONG%3EGroup%20Tag%3C%2FSTRONG%3E%20in%20the%20Intune%20Portal%20%3A-).%20This%20is%20what%20you%20can%20modify%20and%20use%20later%20for%20AAD%20dynamic%20grouping.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Eto%20import%20with%20a%20custom%20Order%20ID%20use%20a%20csv%20like%20this%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EDevice%20Serial%20Number%2CWindows%20Product%20ID%2CHardware%20Hash%3CSTRONG%3E%2COrder%20ID%3C%2FSTRONG%3E%3CBR%20%2F%3E1234-1234-1234-1234-1234-1234-12%2C%2C%3CYOURHASH%3E%3CSTRONG%3E%2CMyOrderID%3C%2FSTRONG%3E%3C%2FYOURHASH%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Eit%20will%20result%20in%20something%20like%20this%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F101573iA4C5C553EF6501A4%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22SNAG-0060.png%22%20title%3D%22SNAG-0060.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Ebest%2C%3C%2FP%3E%0A%3CP%3EOliver%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-393424%22%20slang%3D%22en-US%22%3ERe%3A%20How%20do%20we%20set%20PurchaseOrderId%20using%20Get-WindowsAutoPilotInfo.ps1%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-393424%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F106235%22%20target%3D%22_blank%22%3E%40Oliver%20Kieselbach%3C%2FA%3E%26nbsp%3BHi%20Oliver%2C%20you%20say%20to%20use%20(or%20add)%20the%20OrderID%20column%20in%20the%20Autopilot%20CSV%20file%2C%20however%20this%20is%20used%20as%20a%20tag.%20According%20to%20a%20few%20articles%20Ive%20seen%20there%20is%20also%20a%20PurchaseOrderID%20colum%20that%20can%20be%20added%20to%20the%20CSV.%20However%20I%20can%20not%20get%20this%20to%20work.%3C%2FP%3E%3CP%3EOn%20one%20technet%20article%20it%20says%20this%20can%20only%20be%20set%20by%20OEM.%20Is%20this%20true%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-269797%22%20slang%3D%22en-US%22%3ERe%3A%20How%20do%20we%20set%20PurchaseOrderId%20using%20Get-WindowsAutoPilotInfo.ps1%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-269797%22%20slang%3D%22en-US%22%3E%3CP%3ECorrect%20there%20is%20no%20support%20in%20the%20script%20at%20the%20moment%20but%20you%20can%20easily%20modify%20and%20extend%20the%20script%20to%20support%20it.%20Then%20you%20can%20target%20group%20of%20devices%20with%20different%20OrderIDs%20to%20accomplish%20your%20goal.%20Just%20add%20a%20new%20parameter%20in%20the%20beginning%20of%20the%20script%20and%20add%20this%20new%20variable%20to%20the%20custom%20ps%20object%20and%20modify%20the%20csv%20output%20to%20include%20%22%2COrder%20ID%22.%20Pretty%20straight%20forward%20%3Athumbs_up%3A%3C%2Fimg%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-269792%22%20slang%3D%22en-US%22%3ERe%3A%20How%20do%20we%20set%20PurchaseOrderId%20using%20Get-WindowsAutoPilotInfo.ps1%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-269792%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Oliver%2C%3C%2FP%3E%3CP%3EThis%20requires%20opening%20the%20CSV%20file%20and%20adding%20the%20order%20id%20to%20the%20end%20of%20the%20file%20and%20also%20modifying%20or%20removing%20the%20header%2C%20we%20have%20tried%20and%20this%20and%20it%20works.%20But%20this%20is%20not%20practical%20for%20us%2C%20we%20are%20planning%20to%20use%20Windows%20Configuration%20Packages%20on%20USB%20drive%20to%20pre-configure%20the%20device%20and%20fetch%20the%20CSV%20file%20(to%20be%20executed%20by%20remote%20non-IT%20users)%2C%20we%20are%20capturing%20the%20CSV%20file%20via%20Azure%20storage%20account.%20We%20would%20like%20to%20automate%20the%20adding%20of%20order%20id%2C%20we%20are%20able%20to%20do%20this%20by%20using%20our%20own%20PowerShell%20script%2C%20but%20we%20are%20wondering%20if%20we%20can%20pass%20an%20additional%20parameter%20to%26nbsp%3B%3CSPAN%3EGet-WindowsAutoPilotInfo.ps1%3C%2FSPAN%3E%20script%20to%20add%26nbsp%3Bthe%20order%20id%2C%20looks%20this%20is%20not%20possible%20at%20the%20moment.%3C%2FP%3E%3CP%3EBest%20regards%2C%3C%2FP%3E%3CP%3ERajesh%20Khanikar%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-269788%22%20slang%3D%22en-US%22%3ERe%3A%20How%20do%20we%20set%20PurchaseOrderId%20using%20Get-WindowsAutoPilotInfo.ps1%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-269788%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Rajesh%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Ethat's%20pretty%20simple%20just%20add%20%22%2COrder%20ID%22%20in%20the%20header%20row%20and%20append%20your%20custom%20Order%20ID%20%22%2CMyOrderID%22%20at%20the%20end%20of%20a%20device%20entry%20row.%20Simplified%20example%20to%20make%20it%20more%20clear%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EDevice%20Serial%20Number%2CWindows%20Product%20ID%2CHardware%20Hash%2COrder%20ID%3CBR%20%2F%3E1234-1234-1234-1234-1234-1234-12%2C%2CT0GqAwEAHAAAAAoAAQDuQgA....%2CMyOrderID%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Ebest%2C%3C%2FP%3E%0A%3CP%3EOliver%3C%2FP%3E%3C%2FLINGO-BODY%3E
Rajesh Khanikar
Occasional 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?

5 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
1234-1234-1234-1234-1234-1234-12,,T0GqAwEAHAAAAAoAAQDuQgA....,MyOrderID

 

best,

Oliver

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
1234-1234-1234-1234-1234-1234-12,,<yourhash>,MyOrderID

 

it will result in something like this:

 

SNAG-0060.png

 

best,

Oliver

Related Conversations
Extentions Synchronization
Deleted in Discussions on
3 Replies
Tabs and Dark Mode
cjc2112 in Discussions on
38 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies