Skip to content

Commit 71d55e9

Browse files
committed
Fixed GetVcores
1 parent a76d855 commit 71d55e9

5 files changed

Lines changed: 26 additions & 4 deletions

File tree

samples/manage/DiscoverSql.ps1

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
3+
# This script checks if SQL Server is installed on Windows
4+
5+
[bool] $SqlInstalled = $false
6+
$regPath = 'HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server'
7+
if (Test-Path $regPath) {
8+
$inst = (get-itemproperty $regPath).InstalledInstances
9+
$SqlInstalled = ($inst.Count -gt 0)
10+
}
11+
Write-Output $SqlInstalled

samples/manage/DiscoverSql.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
if ! systemctl is-active --quiet mssql-server.service; then
2+
echo "False"
3+
exit
4+
else
5+
echo "True"
6+
fi

samples/manage/azure-hybrid-benefit/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ The script accepts the following command line parameters:
5757
|-Database|database_name|Optional: database name where data will be saved.<br> Must be accompanied by -Server and -Cred|
5858
|-Cred|credential_object|Optional: value of type PSCredential to securely pass database user and password|
5959
|-FilePath|csv_file_name|Optional: filename where the data will be saved in a .csv format. Ignored if database parameters are specified|
60-
|-ShowUnregistered|\$True or \$False (default)|Optional: causes the script to report the total size of VMs that self-host SQL server instance that is unregistered with the IaaS SQL extension|
60+
|-ShowUnregistered|\$True or \$False (default)|Optional: causes the script to report the total size of VMs with a self-hosted SQL server instance that is unregistered with the IaaS SQL extension|
6161

6262
<sup>1</sup>You can create a .csv file using the following command and then edit to remove the subscriptions you don't want to scan.
6363
```PowerShell

samples/manage/azure-hybrid-benefit/sql-license-usage.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
param (
3030
[Parameter (Mandatory= $false)]
31-
[string] $SubId = '4f6d3845-d3e3-4c31-bdf0-c73464aaff0e',
31+
[string] $SubId,
3232
[Parameter (Mandatory= $false)]
3333
[string] $Server,
3434
[Parameter (Mandatory= $false)]
@@ -88,7 +88,7 @@ function GetVCores {
8888
$global:VM_SKUs = Get-AzComputeResourceSku "westus" | where-object {$_.ResourceType -in 'virtualMachines','hostGroups/hosts'}
8989
}
9090
# Select first size and get the VCPus available
91-
$size_info = $global:VM_SKUs | Where-Object {$_.ResourceType.Contains($type) -and $_.Name.Contains($name)} | Select-Object -First 1
91+
$size_info = $global:VM_SKUs | Where-Object {$_.ResourceType.Contains($type) -and ($_.Name -eq $name)} | Select-Object -First 1
9292

9393
# Save the VCPU count
9494
switch ($type) {
@@ -254,7 +254,7 @@ if ($SubId -like "*.csv") {
254254

255255
[bool] $useDatabase = $PSBoundParameters.ContainsKey("Server") -and $PSBoundParameters.ContainsKey("Cred") -and $PSBoundParameters.ContainsKey("Database")
256256

257-
# Initialize tables and arrays
257+
# Initialize tables and arraystype
258258

259259
if ($useDatabase){
260260

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"Date","Time","Subscription Name","Subscription ID","AHB ECs","PAYG ECs","AHB Std vCores","AHB Ent vCores","PAYG Std vCores","PAYG Ent vCores","HADR Std vCores","HADR Ent vCores","Developer vCores","Express vCores","Unregistered vCores","Unknown vCores"
2+
"2021-03-25","23:03:34","SQL AHB test subscription","b503c0c6-61ce-46ac-9f16-0e5e1d8e2102","0","0","10","4","0","2","0","0","0","0","0","0"
3+
"2021-03-25","23:04:21","Microsoft Azure Enterprise","ef2392d5-903c-445a-89a0-b64bc7d48cf5","0","0","0","0","0","0","0","0","0","0","0","0"
4+
"2021-03-25","23:16:43","SQL AHB test subscription","b503c0c6-61ce-46ac-9f16-0e5e1d8e2102","0","0","10","4","0","8","0","0","0","0","0","0"
5+
"2021-03-25","23:16:53","Microsoft Azure Enterprise","ef2392d5-903c-445a-89a0-b64bc7d48cf5","0","0","0","0","0","0","0","0","0","0","0","0"

0 commit comments

Comments
 (0)