Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Hyper-V/createVM.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ log "Temporarily setting VM name to $VMName"
log "Copying the $version disk from $templates..."
try
{
Copy-Item -Path "$($tempaltes)\GM-$($version).vhdx" -Destination "$($virtualHardDisks)\$($VMName).vhdx" -Force | Out-Null
log "Disk coppied to $virtualHardDisks"
Copy-Item -Path "$($templates)\GM-$($version).vhdx" -Destination "$($virtualHardDisks)\$($VMName).vhdx" -Force | Out-Null
log "Disk copied to $virtualHardDisks"
}
catch
{
Expand Down Expand Up @@ -123,7 +123,7 @@ log "New VM Name will be $newName"

try
{
Renamve-VM -Name $VMName -NewName $newVMName
Rename-VM -Name $VMName -NewName $newVMName
log "VM renamed to $newVMName"
}
catch
Expand Down
27 changes: 27 additions & 0 deletions checkforOOBE.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[string]$AutoPilotSettingsKey = 'HKLM:\SOFTWARE\Microsoft\Provisioning\AutopilotSettings'
[string]$DevicePrepName = 'DevicePreparationCategory.Status'
[string]$DeviceSetupName = 'DeviceSetupCategory.Status'
[bool]$DevicePrepNotRunning = $false
[bool]$DeviceSetupNotRunning = $false

$DevicePrepDetails = (Get-ItemProperty -Path $AutoPilotSettingsKey -Name $DevicePrepName -ErrorAction 'Ignore').$DevicePrepName
$DeviceSetupDetails = (Get-ItemProperty -Path $AutoPilotSettingsKey -Name $DeviceSetupName -ErrorAction 'Ignore').$DeviceSetupName

if (-not [string]::IsNullOrEmpty($DevicePrepDetails)) {
$DeviceSetupDetails = $DeviceSetupDetails | ConvertFrom-Json
}
else {
Write-Output "No_Autopilot_Config"
Exit
}


if ($DeviceSetupDetails.categoryState -eq "inProgress") {
Write-Output "ESP_Running"
Exit
}
else {
Write-Output "ESP_NotRunning"
Exit
}