-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJava.ps1
128 lines (82 loc) · 4.4 KB
/
Java.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
function Get-HWinfo{
param(
[Parameter(Mandatory=$true,Position=0,ValueFromPipeline=$true)]
[string]$Computer
)
process {
$computerSystem = gwmi Win32_ComputerSystem -ComputerName $Computer
$computerBIOS = gwmi Win32_BIOS -ComputerName $Computer
$computerOS = gwmi Win32_OperatingSystem -ComputerName $Computer
$computerCPU = gwmi Win32_Processor -ComputerName $Computer | select -Property Name
$computerCores = gwmi Win32_ComputerSystem -ComputerName $Computer | select NumberOfProcessors, NumberOfLogicalProcessors
$HDD = Get-WmiObject -Class Win32_logicaldisk -ComputerName $Computer -Filter "DriveType = '3'" | select -Property DeviceID,
@{L="Capacity";E={"{0:N2}" -f ($_.Size/1GB)}}
#write-Host "System Information for: " $computerSystem.Name -BackgroundColor DarkCyan
#"-------------------------------------------------------"
#"Manufacturer: " + $computerSystem.Manufacturer
#"Model: " + $computerSystem.Model
#"-------------------------------------------------------"
#"Operating System: " + $computerOS.caption + ", Service Pack: " + $computerOS.ServicePackMajorVersion
###"-------------------------------------------------------"
#"CPU: " + $computerCPU.Name
#"CPU Cores: "+$computerCores
#"-------------------------------------------------------"
#"RAM: " + "{0:N2}" -f ($computerSystem.TotalPhysicalMemory/1GB) + "GB"
#"-------------------------------------------------------"
#"HDD: "
$obj = New-Object -TypeName PSObject -Property @{
Computer=$computerSystem.Name
Manufacturer=$computerSystem.Manufacturer
Model= $computerSystem.Model
System= $computerOS.caption
ServicePack = $computerOS.ServicePackMajorVersion
CPU=$computerCPU
CPUCores= $computerCores
RAM= $computerSystem.TotalPhysicalMemory/1GB
CheckMK= $computerMKV
HDD=$HDD
}
$objects += $obj;
$objects | select Computer, Manufacturer, Model, System , ServicePack, CPU , CPUCores , RAM
$svTbl = @{}
}
}
$Output = ForEach ($servers in Get-Content "C:\scripts\scriptsforadmin\servers.txt")
{
#checkmk/sql
$list=@()
$InstalledSoftwareKey="SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
$InstalledSoftware=[microsoft.win32.registrykey]::OpenRemoteBaseKey('LocalMachine',$servers)
$RegistryKey=$InstalledSoftware.OpenSubKey($InstalledSoftwareKey)
$SubKeys=$RegistryKey.GetSubKeyNames()
Foreach ($key in $SubKeys){
$thisKey=$InstalledSoftwareKey+"\\"+$key
$thisSubKey=$InstalledSoftware.OpenSubKey($thisKey)
$obj = New-Object PSObject
$obj | Add-Member -MemberType NoteProperty -Name "ComputerName" -Value $Servers
$obj | Add-Member -MemberType NoteProperty -Name "DisplayName" -Value $($thisSubKey.GetValue("DisplayName"))
$obj | Add-Member -MemberType NoteProperty -Name "DisplayVersion" -Value $($thisSubKey.GetValue("DisplayVersion"))
$list += $obj
}
$list | where { $_.DisplayName -eq "Check_MK Agent"} | select ComputerName, DisplayName, DisplayVersion | FT
$list | where { $_.DisplayName -match 'Microsoft SQL'} | select ComputerName, DisplayName, DisplayVersion | FT
$list | where { $_.DisplayName -match 'Adobe'} | select ComputerName, DisplayName, DisplayVersion | FT
#checkmk/sql
$list=@()
$InstalledSoftwareKey="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
$InstalledSoftware=[microsoft.win32.registrykey]::OpenRemoteBaseKey('LocalMachine',$servers)
$RegistryKey=$InstalledSoftware.OpenSubKey($InstalledSoftwareKey)
$SubKeys=$RegistryKey.GetSubKeyNames()
Foreach ($key in $SubKeys){
$thisKey=$InstalledSoftwareKey+"\\"+$key
$thisSubKey=$InstalledSoftware.OpenSubKey($thisKey)
$obj = New-Object PSObject
$obj | Add-Member -MemberType NoteProperty -Name "ComputerName" -Value $Servers
$obj | Add-Member -MemberType NoteProperty -Name "DisplayName" -Value $($thisSubKey.GetValue("DisplayName"))
$obj | Add-Member -MemberType NoteProperty -Name "DisplayVersion" -Value $($thisSubKey.GetValue("DisplayVersion"))
$list += $obj
}
$list | where { $_.DisplayName -match 'Adobe'} | select ComputerName, DisplayName, DisplayVersion | FT
Write-Output "------------------------------------------------------------------------------------------------------------------"
}
$Output | Out-File -FilePath C:\scripts\report_servers1.txt