PoshCode Archive  Check-in [5699f4d0a9]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:retrieve the windows product key of a specified machine using WMI
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:5699f4d0a93b5816f6ccf46effe88413b24732dd98faf7c2cad5a850486fa4d1
User & Date: Dan In Philly 2018-06-10 14:22:11
Context
2018-06-10
14:22
Provide a begin and end time frame (mm dd yyyy) and this will calculate the years, months and days between the two dates. This is NOT 100% accurate but it was close enough for what I was trying to do. Someone with better math skills should be able to improve the accuracy. check-in: 597f1652f7 user: Dan In Philly tags: trunk
14:22
retrieve the windows product key of a specified machine using WMI check-in: 5699f4d0a9 user: Dan In Philly tags: trunk
14:22
Provide a begin and end time frame (mm dd yyyy) and this will calculate the years, months and days between the two dates. This is NOT 100% accurate but it was close enough for what I was trying to do. Someone with better math skills should be able to improve the accuracy. check-in: 33b188d7e1 user: Dan In Philly tags: trunk
Changes

Changes to get-windows-product-key.ps1.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# encoding: ascii
# api: powershell
# title: get windows product key
# description: retrieve the windows product key of a specified machine using WMI
# version: 0.1
# type: function
# author: karl prosser
# license: CC0
# function: get-windowsproductkey
# x-poshcode-id: 6884
# x-derived-from-id: 6888
# x-archived: 2017-05-09T05:48:20
# x-published: 2017-05-04T16:42:00
#
# (added 2nd to last line to pull the local computer name then passing that into the function in the last line)
#
function get-windowsproductkey([string]$computer)
{
$Reg = [WMIClass] ("\\" + $computer + "\root\default:StdRegProv")
$values = [byte[]]($reg.getbinaryvalue(2147483650,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","DigitalProductId").uvalue)






|


|
<
|
|







1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
18
19
# encoding: ascii
# api: powershell
# title: get windows product key
# description: retrieve the windows product key of a specified machine using WMI
# version: 0.1
# type: function
# author: Dan In Philly
# license: CC0
# function: get-windowsproductkey
# x-poshcode-id: 6888

# x-archived: 2017-05-13T18:06:26
# x-published: 2017-05-08T04:08:00
#
# (added 2nd to last line to pull the local computer name then passing that into the function in the last line)
#
function get-windowsproductkey([string]$computer)
{
$Reg = [WMIClass] ("\\" + $computer + "\root\default:StdRegProv")
$values = [byte[]]($reg.getbinaryvalue(2147483650,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","DigitalProductId").uvalue)