Forum Discussion

Rajesh Khanikar's avatar
Rajesh Khanikar
Copper Contributor
Oct 10, 2018

How do we set PurchaseOrderId using Get-WindowsAutoPilotInfo.ps1

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?

  • 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

    • Rajesh Khanikar's avatar
      Rajesh Khanikar
      Copper Contributor

      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

      • Oliver Kieselbach's avatar
        Oliver Kieselbach
        MVP

        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 👍

Resources