Resize partition to all Windows vms

This commit is contained in:
Manuel Romero
2020-04-21 16:58:36 +02:00
parent 142a24920d
commit 10b7de7ca6
9 changed files with 22 additions and 12 deletions

View File

@@ -75,7 +75,7 @@ resource "azurerm_virtual_machine" "vm" {
caching = "ReadWrite"
create_option = "FromImage"
managed_disk_type = "Premium_LRS"
#disk_size_gb = "100"
disk_size_gb = "500"
}
os_profile {

View File

@@ -97,4 +97,8 @@ if ($NewCerts) {
REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v ConsentPromptBehaviorAdmin /t REG_DWORD /d 5 /f
Write-Log "Resize Partition C to max size"
Get-PartitionSupportedSize -DriveLetter C
$size = Get-PartitionSupportedSize -DriveLetter C
Resize-Partition -DriveLetter C -Size $size.SizeMax

View File

@@ -140,7 +140,6 @@ resource "azurerm_virtual_machine" "vm" {
"powershell.exe -File C:/provision/qib/qib.ps1 -ExternalURL https://${var.resource_group_name}.qmi.qlik-poc.com",
//"powershell.exe -File C:/provision/carbonblack.ps1 -SensorSettings '${data.azurerm_key_vault_secret.sensorsettings.value}'",
//"powershell.exe -File C:/provision/webconnectors/q-WebConnectors.ps1",
"powershell.exe -File C:/provision/resizepartition_c_tomaxsize.ps1",
]
}

View File

@@ -94,5 +94,8 @@ if ($NewCerts) {
REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v ConsentPromptBehaviorAdmin /t REG_DWORD /d 5 /f
Write-Log "Resize Partition C to max size"
Get-PartitionSupportedSize -DriveLetter C
$size = Get-PartitionSupportedSize -DriveLetter C
Resize-Partition -DriveLetter C -Size $size.SizeMax

View File

@@ -1,3 +0,0 @@
Get-PartitionSupportedSize -DriveLetter C
$size = Get-PartitionSupportedSize -DriveLetter C
Resize-Partition -DriveLetter C -Size $size.SizeMax

View File

@@ -148,8 +148,7 @@ resource "azurerm_virtual_machine" "vm" {
inline = [
"powershell.exe -File C:/provision/qs-post-cfg.ps1 -Hostname ${var.resource_group_name}.qmi.qlik-poc.com -Serial ${data.azurerm_key_vault_secret.serial.value} -Control ${data.azurerm_key_vault_secret.control.value} -Certpassword ${data.azurerm_key_vault_secret.cert-password.value} -QlikUserPassword ${random_password.qlikpassword.result}",
"powershell.exe -File C:/provision/carbonblack.ps1 -SensorSettings '${data.azurerm_key_vault_secret.sensorsettings.value}'",
"powershell.exe -File C:/provision/webconnectors/q-WebConnectors.ps1",
"powershell.exe -File C:/provision/resizepartition_c_tomaxsize.ps1",
"powershell.exe -File C:/provision/webconnectors/q-WebConnectors.ps1"
]
}

View File

@@ -82,4 +82,10 @@ Get-ChildItem cert:"CurrentUser\My"
Write-Log "New Certs: LocalMachine\My"
Get-ChildItem cert:"LocalMachine\My"
Write-Log "New Certs: LocalMachine\Root"
Get-ChildItem cert:"LocalMachine\Root" | Where-Object { $_.Subject -match 'QMI' }
Get-ChildItem cert:"LocalMachine\Root" | Where-Object { $_.Subject -match 'QMI' }
Write-Log "Resize Partition C to max size"
Get-PartitionSupportedSize -DriveLetter C
$size = Get-PartitionSupportedSize -DriveLetter C
Resize-Partition -DriveLetter C -Size $size.SizeMax

View File

@@ -1,3 +0,0 @@
Get-PartitionSupportedSize -DriveLetter C
$size = Get-PartitionSupportedSize -DriveLetter C
Resize-Partition -DriveLetter C -Size $size.SizeMax

View File

@@ -17,3 +17,8 @@ secedit /export /cfg c:\secpol.cfg | Out-Null
secedit /configure /db c:\windows\security\local.sdb /cfg c:\secpol.cfg /areas SECURITYPOLICY | Out-Null
rm -force c:\secpol.cfg -confirm:$false | Out-Null
Write-Log "Resize Partition C to max size"
Get-PartitionSupportedSize -DriveLetter C
$size = Get-PartitionSupportedSize -DriveLetter C
Resize-Partition -DriveLetter C -Size $size.SizeMax