|
1 |
| -<# |
| 1 | +<# |
2 | 2 | .SYNOPSIS
|
3 | 3 | Interactive PowerShell GUI to Collect System, Network, and User Information from Remote Workstations.
|
4 | 4 |
|
@@ -104,34 +104,34 @@ function Collect-Inventory {
|
104 | 104 | }
|
105 | 105 |
|
106 | 106 | $Results += [PSCustomObject]@{
|
107 |
| - Hostname = $Computer |
108 |
| - LoggedUser = $User.UserName |
109 |
| - OperatingSystem = $OS.Caption |
110 |
| - OSVersion = $OS.Version |
111 |
| - LastBootTime = ([Management.ManagementDateTimeConverter]::ToDateTime($OS.LastBootUpTime)) |
112 |
| - IPAddress = $Net.IPAddress -join ', ' |
113 |
| - MACAddress = $Net.MACAddress |
114 |
| - DefaultGateway = $Net.DefaultIPGateway -join ', ' |
115 |
| - AdapterName = $Net.Description |
116 |
| - Domain = $User.Domain |
| 107 | + Hostname = $Computer |
| 108 | + LoggedUser = $User.UserName |
| 109 | + OperatingSystem = $OS.Caption |
| 110 | + OSVersion = $OS.Version |
| 111 | + LastBootTime = ([Management.ManagementDateTimeConverter]::ToDateTime($OS.LastBootUpTime)) |
| 112 | + IPAddress = $Net.IPAddress -join ', ' |
| 113 | + MACAddress = $Net.MACAddress |
| 114 | + DefaultGateway = $Net.DefaultIPGateway -join ', ' |
| 115 | + AdapterName = $Net.Description |
| 116 | + Domain = $User.Domain |
117 | 117 | BIOSManufacturer = $BIOS.Manufacturer
|
118 |
| - SerialNumber = $BIOS.SerialNumber |
| 118 | + SerialNumber = $BIOS.SerialNumber |
119 | 119 | }
|
120 | 120 | } else {
|
121 | 121 | Log-Message -Message "$Computer is unreachable." -Type "WARNING"
|
122 | 122 | $Results += [PSCustomObject]@{
|
123 |
| - Hostname = $Computer |
124 |
| - LoggedUser = "Unavailable" |
125 |
| - OperatingSystem = "Unreachable" |
126 |
| - OSVersion = "N/A" |
127 |
| - LastBootTime = "N/A" |
128 |
| - IPAddress = "N/A" |
129 |
| - MACAddress = "N/A" |
130 |
| - DefaultGateway = "N/A" |
131 |
| - AdapterName = "N/A" |
132 |
| - Domain = "N/A" |
| 123 | + Hostname = $Computer |
| 124 | + LoggedUser = "Unavailable" |
| 125 | + OperatingSystem = "Unreachable" |
| 126 | + OSVersion = "N/A" |
| 127 | + LastBootTime = "N/A" |
| 128 | + IPAddress = "N/A" |
| 129 | + MACAddress = "N/A" |
| 130 | + DefaultGateway = "N/A" |
| 131 | + AdapterName = "N/A" |
| 132 | + Domain = "N/A" |
133 | 133 | BIOSManufacturer = "N/A"
|
134 |
| - SerialNumber = "N/A" |
| 134 | + SerialNumber = "N/A" |
135 | 135 | }
|
136 | 136 | }
|
137 | 137 | } catch {
|
@@ -179,14 +179,14 @@ $buttonRun.Text = "Run Inventory"
|
179 | 179 | $buttonRun.Location = '10,310'
|
180 | 180 | $buttonRun.Size = '220,40'
|
181 | 181 | $buttonRun.Add_Click({
|
182 |
| - $computers = Get-ComputerListFromText -inputText $textBox.Text |
183 |
| - if ($computers.Count -gt 0) { |
184 |
| - $progressBar.Value = 0 |
185 |
| - Collect-Inventory -Computers $computers -ProgressBar $progressBar |
186 |
| - } else { |
187 |
| - Show-ErrorMessage -Message "Please provide at least one valid hostname or IP." |
188 |
| - } |
189 |
| -}) |
| 182 | + $computers = Get-ComputerListFromText -inputText $textBox.Text |
| 183 | + if ($computers.Count -gt 0) { |
| 184 | + $progressBar.Value = 0 |
| 185 | + Collect-Inventory -Computers $computers -ProgressBar $progressBar |
| 186 | + } else { |
| 187 | + Show-ErrorMessage -Message "Please provide at least one valid hostname or IP." |
| 188 | + } |
| 189 | + }) |
190 | 190 | $form.Controls.Add($buttonRun)
|
191 | 191 |
|
192 | 192 | $buttonClose = New-Object System.Windows.Forms.Button
|
|
0 commit comments