[ { "choices": [ ], "data_type": "string", "default_value": "Pending...", "description": "", "display_name": "Windows Autopilot Hash", "field_name": "windows_autopilot_hash", "is_global": true, "metadata": { "macos": { "extension": "sh", "must_exit_zero": true, "replace_line_feed": true, "source": "#!/bin/bash\n#\n# FileWave client will execute this script. The output will be used as the value of the custom field.\n# \n# Below is an example of how to read the value of one ENVIRONMENT VARIABLE in your script:\n\n# my_var=${ENV_VAR_NAME}\n#\necho \"Not Applicable\"\n\nexit 0" }, "windows": { "extension": "ps1", "must_exit_zero": false, "replace_line_feed": true, "source": "#############################################################################\n#If Powershell is running the 32-bit version on a 64-bit machine, we\n#need to force powershell to run in 64-bit mode .\n# Below is an example of how to read the value of one ENVIRONMENT VARIABLE in your script:\n# $my_var = $Env:ENV_VAR_NAME\n#############################################################################\nif ($env:PROCESSOR_ARCHITEW6432 -eq \"AMD64\") {\n #write-warning \"Take me to 64-bit.....\"\n if ($myInvocation.Line) {\n &\"$env:WINDIR\\sysnative\\windowspowershell\\v1.0\\powershell.exe\" -NonInteractive -NoProfile $myInvocation.Line\n }else{\n &\"$env:WINDIR\\sysnative\\windowspowershell\\v1.0\\powershell.exe\" -NonInteractive -NoProfile -file \"$($myInvocation.InvocationName)\" $args\n }\nexit $lastexitcode\n}\n \n# Main script\n# Uncomment the next line to prove that we are always in 64bit\n#[Environment]::Is64BitProcess\n\n# Get a CIM session\n$session = New-CimSession\n\t\t\n# Get the common properties.\n$serial = (Get-CimInstance -CimSession $session -Class Win32_BIOS).SerialNumber\n\n# Get the hash (if available)\n$devDetail = (Get-CimInstance -CimSession $session -Namespace root/cimv2/mdm/dmmap -Class MDM_DevDetail_Ext01 -Filter \"InstanceID='Ext' AND ParentID='./DevDetail'\")\nif ($devDetail)\n{\n\t$hash = $devDetail.DeviceHardwareData\n}\nelse\n{\n\t$bad = $true\n\t$hash = \"Hash Not Available\"\n}\n\necho $hash\n\nexit 0\n\n#############################################################################\n#End\n#############################################################################" } }, "provider": 1, "to_be_deleted": false, "used_in_workflows": false } ]