summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDag Wieers <dag@wieers.com>2018-01-22 22:31:25 +0100
committerGitHub <noreply@github.com>2018-01-22 22:31:25 +0100
commit2963403c8b39f169e46c277eb44ee482b2d15a3d (patch)
treeacbf8294029ea88f821e8f4f288ef7f7a781d9f5
parent9be2289b3d3a7a762a64ff50a0c2144bc738d1ec (diff)
downloadansible-revert-34097-win_setup-key.tar.gz
Revert "win_setup: Add Product ID and Product Key in facts (#34097)"revert-34097-win_setup-key
This reverts commit cf1f7b53dfb88f996593ec37fe455c0a2e272758.
-rw-r--r--lib/ansible/modules/windows/setup.ps131
1 files changed, 0 insertions, 31 deletions
diff --git a/lib/ansible/modules/windows/setup.ps1 b/lib/ansible/modules/windows/setup.ps1
index 156c7dda5d..8be498b3b5 100644
--- a/lib/ansible/modules/windows/setup.ps1
+++ b/lib/ansible/modules/windows/setup.ps1
@@ -54,35 +54,6 @@ Function Get-MachineSid {
return $machine_sid
}
-Function Get-ProductKey {
- # First try to find the product key from ACPI
- $product_key = (Get-CimInstance -Class SoftwareLicensingService).OA3xOriginalProductKey
-
- if (-not $product_key) {
- # Else try to get it from the registry instead
- $data = Get-ItemPropertyValue -Path "HKLM:\Software\Microsoft\Windows NT\CurrentVersion" -Name DigitalProductId
- $hexdata = $data[52..66]
-
- $chardata = "B","C","D","F","G","H","J","K","M","P","Q","R","T","V","W","X","Y","2","3","4","6","7","8","9"
-
- # Decode base24 binary data
- $product_key = $null
- for ($i = 24; $i -ge 0; $i--) {
- $k = 0
- for ($j = 14; $j -ge 0; $j--) {
- $k = $k * 256 -bxor $hexdata[$j]
- $hexdata[$j] = [math]::truncate($k / 24)
- $k = $k % 24
- }
- $product_key = $chardata[$k] + $product_key
- if (($i % 5 -eq 0) -and ($i -ne 0)) {
- $product_key = "-" + $product_key
- }
- }
- }
- return $product_key
-}
-
$result = @{
ansible_facts = @{ }
changed = $false
@@ -209,8 +180,6 @@ $ansible_facts = @{
ansible_nodename = ($ip_props.HostName + "." + $ip_props.DomainName)
ansible_os_family = "Windows"
ansible_os_name = ($win32_os.Name.Split('|')[0]).Trim()
- ansible_os_product_id = $win32_os.SerialNumber
- ansible_os_product_key = Get-ProductKey
ansible_owner_contact = ([string] $win32_cs.PrimaryOwnerContact)
ansible_owner_name = ([string] $win32_cs.PrimaryOwnerName)
ansible_powershell_version = ($PSVersionTable.PSVersion.Major)