From 7e51b78765c5a894de6055cf83b9e356c0508e94 Mon Sep 17 00:00:00 2001 From: "Alexander (Sasha) Nosov" Date: Wed, 5 Jul 2023 16:04:59 -0700 Subject: [PATCH 1/3] Convert -Force to switch --- .../modify-license-type/modify-license-type.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/manage/azure-arc-enabled-sql-server/modify-license-type/modify-license-type.ps1 b/samples/manage/azure-arc-enabled-sql-server/modify-license-type/modify-license-type.ps1 index 1d3dd35b..9ea42929 100644 --- a/samples/manage/azure-arc-enabled-sql-server/modify-license-type/modify-license-type.ps1 +++ b/samples/manage/azure-arc-enabled-sql-server/modify-license-type/modify-license-type.ps1 @@ -36,7 +36,7 @@ param ( [ValidateSet("Yes","No", IgnoreCase=$false)] [string] $EnableESU, [Parameter (Mandatory= $true)] - [boolean] $Force=$false + [switch] $Force ) function CheckModule ($m) { From 354ecc45998d31c6c4f6b9b8549bc93ef8a5895c Mon Sep 17 00:00:00 2001 From: "Alexander (Sasha) Nosov" Date: Wed, 5 Jul 2023 16:25:20 -0700 Subject: [PATCH 2/3] Fixed optionality --- .../modify-license-type/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/manage/azure-arc-enabled-sql-server/modify-license-type/README.md b/samples/manage/azure-arc-enabled-sql-server/modify-license-type/README.md index 0d435598..60681bc5 100644 --- a/samples/manage/azure-arc-enabled-sql-server/modify-license-type/README.md +++ b/samples/manage/azure-arc-enabled-sql-server/modify-license-type/README.md @@ -3,7 +3,7 @@ services: Azure Arc-enabled SQL Server platforms: Azure author: anosov1960 ms.author: sashan -ms.date: 6/21/2023 +ms.date: 7/5/2023 --- @@ -32,7 +32,7 @@ The script accepts the following command line parameters: |-MachineName |machine_name|Optional: Limits the scope to a specific machine| |-LicenceType | "Paid", "PAYG" or "LicenseOnly"| Optional: Sets the license type to the specified value | |-EnableESU | "Yes", "No" | Optional. Enables the ESU policy the value is "Yrs" or disables it if the value is "No". To enable, the license type must be "Paid" or "PAYG"| -|-Force|\$True or \$False (default)|Optional. Forces the change of the license type to the specified value on all installed extensions. If -Force is not specified, the -LicenseType value is set only if undefined. Ignored if -LicenseType is not specified| +|-Force| |Optional. Forces the change of the license type to the specified value on all installed extensions. If -Force is not specified, the -LicenseType value is set only if undefined. Ignored if -LicenseType is not specified| 1You can create a .csv file using the following command and then edit to remove the subscriptions you don't want to scan. ```PowerShell @@ -52,7 +52,7 @@ The following command will scan all the subscriptions to which the user has acce The following command will scan the subscription `` and set the license type value to "Paid" on all servers. ```PowerShell -.\modify-license-type.ps1 -SubId -LicenseType Paid -Force $True +.\modify-license-type.ps1 -SubId -LicenseType Paid -Force ``` ## Example 3 @@ -60,7 +60,7 @@ The following command will scan the subscription `` and set the license The following command will scan resource group in the subscription `` and set the license type value to "PAYG" on all servers. ```PowerShell -.\modify-license-type.ps1 -SubId -ResourceGroup -LicenseType PAYG -Force $True +.\modify-license-type.ps1 -SubId -ResourceGroup -LicenseType PAYG -Force ``` # Running the script using Cloud Shell From d82dfc0b38a4c83cad6d557f2b193d0c541bdeef Mon Sep 17 00:00:00 2001 From: "Alexander (Sasha) Nosov" Date: Wed, 5 Jul 2023 16:25:35 -0700 Subject: [PATCH 3/3] Fixed optionality --- .../modify-license-type/modify-license-type.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/manage/azure-arc-enabled-sql-server/modify-license-type/modify-license-type.ps1 b/samples/manage/azure-arc-enabled-sql-server/modify-license-type/modify-license-type.ps1 index 9ea42929..bd583e74 100644 --- a/samples/manage/azure-arc-enabled-sql-server/modify-license-type/modify-license-type.ps1 +++ b/samples/manage/azure-arc-enabled-sql-server/modify-license-type/modify-license-type.ps1 @@ -14,7 +14,7 @@ # -LicenseType [license_type_value] (Optional. Sets the license type to the specified value) # -EnabelESU [Yes or No] (Optional. Enables the ESU policy the value is "Yes" or disables it if the value is "No" # To enable, the license type must be "Paid" or "PAYG" -# -Force [$true or $false] (Optional. Forces the chnahge of the license type to the specified value on all installed extensions. +# -Force (Optional. Forces the chnahge of the license type to the specified value on all installed extensions. # If Force is not specified, the -LicenseType value is set only if undefined. Ignored if -LicenseType is not specified # # This script uses a function ConvertTo-HashTable that was created by Adam Bertram (@adam-bertram). @@ -35,7 +35,7 @@ param ( [Parameter (Mandatory= $false)] [ValidateSet("Yes","No", IgnoreCase=$false)] [string] $EnableESU, - [Parameter (Mandatory= $true)] + [Parameter (Mandatory= $false)] [switch] $Force )