1
+ function Get-NetFramework {
2
+ <#
3
+ . SYNOPSIS
4
+ This function will retrieve the list of Framework Installed on the computer.
5
+ . DESCRIPTION
6
+ This function will retrieve the list of Framework Installed on the computer.
7
+ . EXAMPLE
8
+ Get-NetFramework
9
+ PSChildName Version
10
+ ----------- -------
11
+ v2.0.50727 2.0.50727.4927
12
+ v3.0 3.0.30729.4926
13
+ Windows Communication Foundation 3.0.4506.4926
14
+ Windows Presentation Foundation 3.0.6920.4902
15
+ v3.5 3.5.30729.4926
16
+ Client 4.5.51641
17
+ Full 4.5.51641
18
+ Client 4.0.0.0
19
+ . NOTES
20
+ TODO:
21
+ Credential support
22
+ ComputerName
23
+ $hklm = 2147483650
24
+ $key = "SOFTWARE\Microsoft\NET Framework Setup"
25
+ $value = "NDP"
26
+ Get-wmiobject -list "StdRegProv" -namespace root\default -computername . |
27
+ Invoke-WmiMethod -name GetDWORDValue -ArgumentList $hklm,$key,$value | select uvalue
28
+ #http://stackoverflow.com/questions/27375012/check-remote-wmi-and-remote-registry
29
+ . LINK
30
+ https://github.com/lazywinadmin/PowerShell
31
+ #>
32
+ [CmdletBinding ()]
33
+ PARAM (
34
+ [String []]$ComputerName ,
35
+ [pscredential ]
36
+ $Credential = [System.Management.Automation.PSCredential ]::Empty
37
+ )
38
+
39
+ $Splatting = @ {
40
+ ComputerName = $ComputerName
41
+ }
42
+
43
+ if ($PSBoundParameters [' Credential' ]) { $Splatting.credential = $Credential }
44
+
45
+ Invoke-Command @Splatting - ScriptBlock {
46
+ Write-Verbose - Message " $pscomputername "
47
+
48
+ # Get the Net Framework Installed
49
+ $netFramework = Get-ChildItem - Path ' HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' - recurse |
50
+ Get-ItemProperty - name Version - EA 0 |
51
+ Where-Object - FilterScript { $_.PSChildName -match ' ^(?!S)\p{L}' } |
52
+ Select-Object - Property PSChildName, Version
53
+
54
+ # Prepare output
55
+ $Properties = @ {
56
+ ComputerName = " $ ( $env: Computername ) $ ( $env: USERDNSDOMAIN ) "
57
+ PowerShellVersion = $psversiontable.PSVersion.Major
58
+ NetFramework = $netFramework
59
+ }
60
+ New-Object - TypeName PSObject - Property $Properties
61
+ }
62
+ }
0 commit comments