Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

online option with grouptag for existing windows autopilot devices doesn't update GroupTag #4

Closed
thiagobeier opened this issue Jun 16, 2023 · 3 comments

Comments

@thiagobeier
Copy link
Contributor

all parameters are working fine for brand new devices

if we run
; brand new devices to windows autopilot
.\get-windowsautopilotinfo-v1.ps1 -Online -TenantId aaaa -AppId bbbb -AppSecret cccc -GroupTag HYBRID -Verbose

; existing devices in windows autopilot (we want only update existing GroupTag)
;brand new device to windows autopilot
.\get-windowsautopilotinfo-v1.ps1 -Online -TenantId aaaa -AppId bbbb -AppSecret cccc -Assign -GroupTag HYBRID -Verbose

if we run the functions separately works

Get-AutopilotDevice | Where-Object { $.serialnumber -eq "VM" }
Set-AutopilotDevice -id 58bdc576-d87f-41a3-aec4-9cba1177a19c -groupTag "HYBRID"
Invoke-AutopilotSync
Get-AutopilotDevice | Where-Object { $
.serialnumber -eq "VM" }

@andrew-s-taylor
Copy link
Owner

V1.0.1 of community version now looks for the device, if it exists, just updates the group tag

@thiagobeier
Copy link
Contributor Author

thiagobeier commented Jun 17, 2023

I've tested
it stops waiting for the Set-AutopilotDevice -id

VERBOSE: Importing function 'Update-MgUserScopedRoleMemberOf'.
Connected to Intune tenant NNNNNNNNNNNNN using app-based authentication (Azure AD authentication not supported)
VERBOSE: Operation '' complete.
VERBOSE: Checking localhost
VERBOSE: Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' =
root\cimv2,'className' = Win32_BIOS'.
VERBOSE: Operation 'Enumerate CimInstances' complete.
VERBOSE: Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM
MDM_DevDetail_Ext01 WHERE InstanceID='Ext' AND ParentID='./DevDetail','queryDialect' = WQL,'namespaceName' =
root/cimv2/mdm/dmmap'.
VERBOSE: Operation 'Query CimInstances' complete.
Gathered details for device with serial number: 8547-1568-1987-0982-5331-6302-49 << vm serial number
VERBOSE: GET https://graph.microsoft.com/beta/deviceManagement/importedWindowsAutopilotDeviceIdentities
VERBOSE: GET https://graph.microsoft.com/beta/deviceManagement/importedWindowsAutopilotDeviceIdentities with 0-byte
payload
VERBOSE: received 5763-byte response of content type application/json

cmdlet Set-AutopilotDevice at command pipeline position 1
Supply values for the following parameters:
id:

if you hit enter here you the following....

cmdlet Set-AutopilotDevice at command pipeline position 1
Supply values for the following parameters:
id:
VERBOSE: POST https://graph.microsoft.com/beta/deviceManagement/windowsAutopilotDeviceIdentities//UpdateDeviceProperties
{ groupTag: "MYTAGHERE" }
VERBOSE: POST https://graph.microsoft.com/beta/deviceManagement/windowsAutopilotDeviceIdentities//UpdateDeviceProperties
with 25-byte payload
VERBOSE: received 456-byte response of content type application/json
Set-AutopilotDevice : Microsoft.Graph.PowerShell.Authentication.Helpers.HttpResponseException: Response status code does
not indicate success: BadRequest (Bad Request).
at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)
At C:\temp\get-windowsautopilotinfo.ps1:1987 char:30

  • ... $imported += Set-AutopilotDevice -groupTag $_.'Group Tag'
  •                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
    • FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Set-AutopilotDevice

I'll try to figure it out somehow.
https://stgacct010101.blob.core.windows.net/shared/ERROR1.png

@andrew-s-taylor
Copy link
Owner

Pulled request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants