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
3 changes: 2 additions & 1 deletion Intune.HV.Tools/Private/Get-AutopilotPolicy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ function Get-AutopilotPolicy {
else {
if ($apPolicies.count -gt 1) {
Write-Host "Multiple Autopilot policies found - select the correct one.." -ForegroundColor Cyan
$apPol = $apPolicies | Select-Object displayName | Out-GridView -passthru
$selectedAp = $apPolicies | Select-Object displayName | Out-GridView -passthru
$apPol = $apPolicies | Where-Object {$_.displayName -eq $selectedAp.displayName}
}
else {
Write-Host "Policy found - saving to $FileDestination.." -ForegroundColor Cyan
Expand Down
2 changes: 1 addition & 1 deletion Intune.HV.Tools/Public/Add-ImageToConfig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function Add-ImageToConfig {
refImagePath = $ReferenceVHDX
}
$script:hvConfig.images += $newTenant
$script:hvConfig | ConvertTo-Json -Depth 20 | Out-File -FilePath $hvConfig.hvConfigPath -Encoding ascii -Force
$script:hvConfig | ConvertTo-Json -Depth 20 | Out-File -FilePath $script:hvConfig.hvConfigPath -Encoding ascii -Force
Write-Host $script:tick -ForegroundColor Green
#region Check for ref image - if it's not there, build it
if (!(Test-Path -Path $newTenant.refImagePath -ErrorAction SilentlyContinue)) {
Expand Down
2 changes: 1 addition & 1 deletion Intune.HV.Tools/Public/Add-NetworkToConfig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function Add-NetworkToConfig {
if ($VLanId) {
$script:hvConfig.vLanId = $VLanId
}
$script:hvConfig | ConvertTo-Json -Depth 20 | Out-File -FilePath $hvConfig.hvConfigPath -Encoding ascii -Force
$script:hvConfig | ConvertTo-Json -Depth 20 | Out-File -FilePath $script:hvConfig.hvConfigPath -Encoding ascii -Force
}
catch {
$errorMsg = $_
Expand Down
2 changes: 1 addition & 1 deletion Intune.HV.Tools/Public/Add-TenantToConfig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function Add-TenantToConfig {
AdminUpn = $AdminUpn
}
$script:hvConfig.tenantConfig += $newTenant
$script:hvConfig | ConvertTo-Json -Depth 20 | Out-File -FilePath $hvConfig.hvConfigPath -Encoding ascii -Force
$script:hvConfig | ConvertTo-Json -Depth 20 | Out-File -FilePath $script:hvConfig.hvConfigPath -Encoding ascii -Force
}
catch {
$errorMsg = $_
Expand Down
31 changes: 13 additions & 18 deletions Intune.HV.Tools/Public/Initialize-HVTools.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,20 @@ function Initialize-HVTools {
}
$cfgPath = "$Path\.hvtools\hvconfig.json"
Write-Host " + Creating $cfgPath.. " -ForegroundColor Cyan -NoNewline
if ((Test-Path $cfgPath -ErrorAction SilentlyContinue) -and ($Reset -eq $false)) {
Write-Host "$script:tick (Already created - no need to run this again..)" -ForegroundColor Green
}
else {
$initCfg = @{
'hvConfigPath' = $cfgPath
'images' = @()
"vmPath" = "$Path\.hvtools\tenantVMs"
'vSwitchName' = $null
'vLanId' = $null
'tenantConfig' = @()
} | ConvertTo-Json -Depth 20
$initCfg | Out-File $cfgPath -Encoding ascii -Force
$cfgPath | Out-File "$env:USERPROFILE\.hvtoolscfgpath" -Encoding ascii -Force
Write-Host $script:tick -ForegroundColor Green
$script:hvConfig = (get-content -Path "$(get-content "$env:USERPROFILE\.hvtoolscfgpath" -ErrorAction SilentlyContinue)" -raw -ErrorAction SilentlyContinue | ConvertFrom-Json)
}
$initCfg = @{
'hvConfigPath' = $cfgPath
'images' = @()
"vmPath" = "$Path\.hvtools\tenantVMs"
'vSwitchName' = $null
'vLanId' = $null
'tenantConfig' = @()
} | ConvertTo-Json -Depth 20
$initCfg | Out-File $cfgPath -Encoding ascii -Force
$cfgPath | Out-File "$env:USERPROFILE\.hvtoolscfgpath" -Encoding ascii -Force
Write-Host $script:tick -ForegroundColor Green
$script:hvConfig = (get-content -Path "$(get-content "$env:USERPROFILE\.hvtoolscfgpath" -ErrorAction SilentlyContinue)" -raw -ErrorAction SilentlyContinue | ConvertFrom-Json)
}
catch {
Write-Warning $_
}
}
}