Repository navigation
chore(validation): restart the agent the way that works, and bring the kit's scripts and docs up to date #44
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| #Requires -Version 7.4 | ||
| #Requires -Version 7.6 | ||
| #Requires -Modules Microsoft.Graph.Authentication | ||
|
|
||
| <# | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| #Requires -Version 7.4 | ||
| #Requires -Version 7.6 | ||
| #Requires -Modules Microsoft.Graph.Authentication | ||
|
|
||
| <# | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,14 +42,15 @@ function Invoke-Qm { | |
| $out | ||
| } | ||
|
|
||
| # The guest agent calls are GuestAgent.ps1's; Invoke-GuestPowerShell reads $ProxmoxHost and $VmId | ||
| # from this scope | ||
| . (Join-Path -Path $PSScriptRoot -ChildPath 'GuestAgent.ps1') | ||
|
|
||
| function Invoke-Guest { | ||
| # Runs PowerShell inside the VM via the guest agent; returns stdout or $null if the agent isn't up. | ||
| # Runs PowerShell inside the VM; $null while the agent is not up, which the OOBE wait polls on | ||
| param([Parameter(Mandatory)][string]$Script) | ||
| $encoded = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($Script)) | ||
| $raw = ssh -o BatchMode=yes $ProxmoxHost ("qm guest exec $VmId --timeout 60 -- powershell -NoProfile " + | ||
| "-NonInteractive -EncodedCommand $encoded") 2>$null | ||
| if ($LASTEXITCODE -ne 0 -or -not $raw) { return $null } | ||
| (($raw -join "`n") | ConvertFrom-Json).'out-data' | ||
| try { Invoke-GuestPowerShell -Script $Script -TimeoutSeconds 60 -WarningAction SilentlyContinue } | ||
| catch { $null } | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Kept as a wrapper rather than calling Invoke-GuestPowerShell directly: the OOBE wait polls a VM whose agent is not running yet, and GuestAgent.ps1 throws after three failed exec attempts where the old helper returned $null. The wrapper keeps that contract so Wait-GuestAtOobe's loop is unchanged; warnings are silenced for the same reason. |
||
| } | ||
|
|
||
| function Wait-GuestAtOobe { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,8 +35,7 @@ with the documented behaviour next to the observed one. | |
| - An app registration with certificate auth and these application permissions: | ||
| `DeviceManagementScripts.ReadWrite.All`, `DeviceManagementConfiguration.ReadWrite.All`, | ||
| `DeviceManagementApps.ReadWrite.All`, `DeviceManagementManagedDevices.Read.All`, | ||
| `Group.ReadWrite.All`, `Device.Read.All`. | ||
| `Scripts\Entra\Grant-ClaudeDevTenantPermissions.ps1` grants them. | ||
| `Group.ReadWrite.All`, `Device.Read.All`, granted as application permissions with admin consent. | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The script this line named lived in the monorepo's Scripts\Entra folder and was not carried over, so the sentence now says what has to be true of the app registration rather than how it was once done. |
||
| - A Proxmox host reachable over key-based SSH, a sysprepped Windows 11 Enterprise/Pro template | ||
| with the QEMU guest agent installed, and a licensed test user (Windows E3/E5 for remediations). | ||
| - `Tools\IntuneWinAppUtil.exe` (only for the Win32 experiments). `Deploy` downloads it from | ||
|
|
@@ -50,7 +49,7 @@ remediations are assigned hourly and will keep running on whatever is in the gro | |
|
|
||
| ```powershell | ||
| $conn = @{ TenantId = '<tenant>'; ClientId = '<app>'; CertificateThumbprint = '<thumbprint>' } | ||
| cd Scripts\Intune\IntuneScriptLab\Validation | ||
| cd Validation | ||
|
|
||
| # 1. Test VM. Ends at the OOBE account screen with a clean-oobe snapshot. | ||
| .\New-IntuneLabVm.ps1 -TemplateId 123 -VmId 125 -Name INTUNE-TEST-02 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stop-Service is tried first and allowed to fail, because on a healthy agent it is the clean path and round 11 only showed it failing on a stuck one. The process id is read before the stop so the kill targets the process that was the service, not whatever Start-Service may have already spawned; the Get-Process check skips the kill when the stop did work.