• Skip to primary navigation
  • Skip to main content
  • Skip to footer

Stephanos Constantinou Blog

PowerShell Scripting

  • Home
  • Blogs
    • PowerShell Tutorials
    • PowerShell Scripts
    • PowerShell Modules
      • Modules Cmdlets
    • Software Reviews
  • About
  • Contact
You are here: Home / PowerShell Scripts / How To Get Remote System Information – Part 2

How To Get Remote System Information – Part 2

26/02/2018 by Stephanos 5 Comments

How To Get Remote System Information – Part 2

Scenario:

How to get remote system information – Part 2

For those who have not read Part of the series, we have discussed about creating UI with PowerShell and getting information from local and remote computer systems. In Part 2 we are going to discuss about some changes that have been applied on the script and the reason behind of those changes. The changes on the script have been done to increase the functionality, stability and be able to retrieve more information from the systems.

As you will be able to see in the synopsis of the script the below changes have been done.

  • Added Fan information
  • Added Battery Information
  • Added Portable Battery Information
  • Added Network Settings Information
  • Added ping connection test of remote system
  • Added Remote Desktop connection to the remote system
  • Warning for the use of Win32_Product class
  • Added option for Win32Reg_AddRemovePrograms class.
  • Added visibility to Taskbar
  • Added Help information
Let’s check every point in more detail

The first four points from the above list, allow us to retrieve extra information from the local or remote system. As we have mentioned also in Part 1, this depends on the system if it can provide the information. If the system is not able to provide this information, then nothing will be shown. For the fan, the script will get the name, caption, description, install date, active cooling status, desired speed and variable speed. Not all system are able to provide this information. For battery and portable battery, the script will get all the information available if the system is able to provide it.

For network settings, the script will get all the network devices with the related information for each device. The information for each device is the description and MAC address, if it is DHCP enabled, DHCP leased and DHCP server. It will get DNS related information, such as, DNS Domain, DNS hostname, DNS registration status and other. Of course we will get also, the IP settings of the network device like IP Address, Default Gateway, Subnet mask.

Ping Test and Remote Desktop Connection

As an extra functionality of the script I have added ping test to the remote system and remote desktop connection. For the ping test, we have used the command Test-Connection directly from PowerShell using the default setting. This will ping the remote system and provide us the result same way as a normal ping test with Command Prompt. If the Computer Name field is empty, we will receive an error on the screen that we have to provide a computer name to perform the test.

For the remote desktop connection, we actually launch the default application by Microsoft to connect to the remote systems. When we click this button, the application will be launched directly trying to connect to the specific remote system, asking for credentials to connect to it. If the computer name field is empty, the application will still be launched but it will be empty or filled with the latest connection that you have made using Remote Desktop Connection.

By the above additions in the functionality of the script we can directly get information of the hardware of the system. We are able to see the installed software of the system along with the processes running and services on the system. We can check the network settings of the system and perform a ping test to it. And at the same time will be able to directly connect to the remote system using the default remote desktop application without the need of going to find and run the application separately.

Screenshot of the GUI of Get-SysInfo.ps1 (Version 1.1)
Software Information Issue

In Part 1, we were able to get the information for the software installed on a system using Win32_Product. As you may or may not know the specific class is not stable and most of the times can cause an issue on the system. The problem appears when you are trying to apply any filter. When you are querying the system to get the information for the software, the problem appears. Below is the warning from Microsoft

Warning  Win32_Product is not query optimized. Queries such as “select * from Win32_Product where (name like ‘Sniffer%’)” require WMI to use the MSI provider to enumerate all of the installed products and then parse the full list sequentially to handle the “where” clause. This process also initiates a consistency check of packages installed, verifying and repairing the install. With an account with only user privileges, as the user account may not have access to quite a few locations, may cause delay in application launch and an event 11708 stating an installation failure. For more information, see KB Article 794524.

There are two alternative ways to get the software information. The first one is to use another class which is not installed in Windows by default, called Win32Reg_AddRemovePrograms. This class can be found only if you have SCCM client installed on your computer. The second alternative is to check through the registry to get the information.

Solution to the software information problem

A temporary solution to the above situation was to enable both classes in the script. When someone will click on the “Software” button, then the script will pop up another form and will ask you to select which class you want  to use. If you select Win32Reg_AddRemovePrograms, then the script will use that class and get the information from the local or remote system that you want. The second form will close and the information will be show on the main form. If the user will select to use Win32_Product class, the script will pop up a warning message to approve the action with Yes or No. If the user will select yes then the script will get the information using Win32_Product class. If the user will select No the warning message will disappear and he will need to select another option or close the form with the options.

Get-SysInfo - Class Option screenshot

With this way, the script warns the administrator for the use of Win32_Product class usage and has the option NOT to perform the action. To accomplish the above, a new form has been designed within the function of “Software_info”. At the point of software information we have nested functions that allow us to perform the above operations. During the process I have described above, We are using a form and a message box. The message boxes have specific values in terms of buttons. You cannot define your own buttons’ text, but you can define what will done when the specific button will be clicked. As we want to have custom buttons for the class options and we are not able to have it with message box, we create our own custom form.

Get SysInfo Message Box
Requirements

First of all as we are using CIM commands you will need to have at least PowerShell 3.0 installed on the computer/ server that you will run the script. Secondly the user that will run the script need to have remote management permission on the remote system to be able to connect and get the information. The last thing that you need to ensure is that the remote system will need to run WINRM to be able to connect to it. WMI commands are using DCOM connection to remote system. CIM commands are using WSMAN to connect to the remote system. If you are not running WINRM on them then you will not be able to get any information. Note that script will work if you run it locally as CIM uses DCOM to connect to the local system and if no computer name will be specified the script will provide information of the local system.

You can download the script here or copy it from below.

Hope you like it. If you have any questions or anything else please let me know in the comments below.

Stay tuned for the next part of this series.

Related Links:

  • How to get remote system information – Part 1
  • How to get remote system information – Part 3
  • How to get remote system information – Part 4
  • Win32_Product class (Windows) – MSDN – Microsoft
  • PowerShell script to get computer information
  • Get-CimInstance (CimCmdlets) – Microsoft Docs
  • Out-String – Microsoft Docs
  • Add-Type – Microsoft Docs
  • New-Object – Microsoft Docs

Solution / Script:

<#
.SYNOPSIS
  Name: Get-SysInfo.ps1
  The purpose of this script is to retrieve information of remote systems.
.DESCRIPTION
  This is a simple script with UI to retrieve information of remote system regarding the hardware,
  software and peripherals.
  It will gather hardware specifications, peripherals, installed software, running processes, services
  and Operating System through a very simple and functioning GUI.
.RELATED LINKS
  Home
.NOTES
  Version:      1.1
  Updated:      25-02-2018     - Added Fan Information
                               - Added Battery Information
                               - Added Portable Battery Information
                               - Added Network Settings Information
                               - Added ping connection test of remote system
                               - Added Remote Desktop connection to the machine.
                               - Warning for the use of Win32_Product class
                               - Added option for Win32Reg_AddRemovePrograms class
                               - Added visibility to Taskbar
  Release Date: 22-02-2018
  Author: Stephanos Constantinou
.EXAMPLE
  Run the Get-SysInfo script to retrieve the information.
  Get-SysInfo.ps1
#>
$System_info = {
   $ComputerName = $txt_ComputerName.Text
   $System = Get-CimInstance -Class Win32_ComputerSystem -ComputerName $ComputerName
   $lbl_sysinfo.Text = $System | FL -Property Name,
                                              Manufacturer,
                                              Model,
                                              PartOfDomain,
                                              Domain,
                                              Workgroup,
                                              DNSHostName,
                                              NumberOfProcessors,
                                              NumberOfLogicalProcessors,
                                              TotalPhysicalMemory,
                                              CurrentTimeZone,
                                              DaylightInEffect,
                                              HypervisorPresent,
                                              PrimaryOwnerName,
                                              UserName | Out-String}
$bios_info = {
   $ComputerName = $txt_ComputerName.Text
   $Bios = Get-CimInstance -Class Win32_BIOS -ComputerName $ComputerName
   $lbl_sysinfo.Text = $Bios | FL -Property Name,
                                            SerialNumber,
                                            Version,
                                            BIOSVersion,
                                            ReleaseData | Out-String}
$CPU_info = {
   $ComputerName = $txt_ComputerName.Text
   $CPU = Get-CimInstance -Class Win32_Processor -ComputerName $ComputerName
   $lbl_sysinfo.Text = $CPU | FL -Property DeviceID,
                                           Manufacturer,
                                           Name,
                                           Caption,
                                           L2CacheSize,
                                           L3CacheSize,
                                           LoadPercentage,
                                           CurrentClockSpeed | Out-String}
$RAM_info = {
   $ComputerName = $txt_ComputerName.Text
   $RAM = Get-CimInstance -Class Win32_PhysicalMemory -ComputerName $ComputerName
   $lbl_sysinfo.Text = $RAM | FL -Property Tag,
                                           DeviceLocator,
                                           Manufacturer,
                                           PartNumber,
                                           SerialNumber,
                                           Capacity,
                                           Speed | Out-String}
$MB_info = {
   $ComputerName = $txt_ComputerName.Text
   $MB = Get-CimInstance -Class Win32_BaseBoard -ComputerName $ComputerName
   $lbl_sysinfo.Text = $MB | FL -Property Manufacturer,
                                          Model,
                                          Version | Out-String}
$PhysicalDrives_info = {
   $ComputerName = $txt_ComputerName.Text
   $PhysicalDrives = Get-CimInstance -Class Win32_DiskDrive -ComputerName $ComputerName
   $lbl_sysinfo.Text = $PhysicalDrives | FL -Property DeviceID,
                                                      FirmwareRevision,
                                                      Manufacturer,
                                                      Model,
                                                      MediaType,
                                                      SerialNumber,
                                                      InterfaceType,
                                                      Partitions,
                                                      Size,
                                                      TotalCylinders,
                                                      TotalHeads,
                                                      TotalSectors,
                                                      TotalTracks,
                                                      TracksPerCylinderBytePerSector,
                                                      SectorsPerTrack,
                                                      Capabilities,
                                                      CapabilityDescriptions,
                                                      Status | Out-String}
$LogicalDrives_info = {
   $ComputerName = $txt_ComputerName.Text
   $LogicalDrives = Get-CimInstance -Class Win32_LogicalDisk -ComputerName $ComputerName
   $lbl_sysinfo.Text = $LogicalDrives | FL -Property DeviceID,
                                                     Description,
                                                     VolumeName,
                                                     ProviderName,
                                                     Size,
                                                     FreeSpace,
                                                     VolumeSerialNumber,
                                                     FileSystem,
                                                     Compressed | Out-String}
$GPU_info = {
   $ComputerName = $txt_ComputerName.Text
   $GPU = Get-CimInstance -Class Win32_VideoController -ComputerName $ComputerName
   $lbl_sysinfo.Text = $GPU | FL -Property DeviceID,
                                           Name,
                                           VideoProcessor,
                                           AdapterDACType,
                                           AdapterRAM,
                                           DriverDate,
                                           DriverVersion,
                                           VideoModeDescription,
                                           CurrentBitsPerPixel,
                                           CurrentHorizontalResolution,
                                           CurrentVerticalResolution,
                                           CurrentNumberOfColors,
                                           CurrentRefreshRate,
                                           MaxRefreshRate,
                                           MinRefreshRate,
                                           Status | Out-String}
$Network_info = {
   $ComputerName = $txt_ComputerName.Text
   $Network = Get-CimInstance -Class Win32_NetworkAdapter -ComputerName $ComputerName
   $lbl_sysinfo.Text = $Network | FL -Property DeviceID,
                                               Name,
                                               Manufacturer,
                                               ProductName,
                                               ServiceName,
                                               MACAddress,
                                               AdapterType,
                                               NetConnectionID,
                                               NetEnabled,
                                               Speed,
                                               PhysicalAdapter,
                                               TimeOfLastReset | Out-String}
$NetSettings_info = {
   $ComputerName = $txt_ComputerName.Text
   $NetSettings = Get-CimInstance -Class Win32_NetworkAdapterConfiguration -ComputerName $ComputerName
   $lbl_sysinfo.Text = $NetSettings | FL -Property Description,
                                                   DHCPEnabled,
                                                   DHCPLeaseObtained,
                                                   DNSDomain,
                                                   DNSDomainSuffixSearchOrder,
                                                   DHCPServer,
                                                   DNSHostName,
                                                   DNSServerSearchOrder,
                                                   DomainDNSRegistrationEnabled,
                                                   FullDNSRegistrationEnabled,
                                                   IPEnabled,
                                                   IPAddress,
                                                   DefaultIPGateway,
                                                   IPSubnet,
                                                   MACAddress,
                                                   ServiceName | Out-String}
$Monitor_info = {
   $ComputerName = $txt_ComputerName.Text
   $Monitor = Get-CimInstance -Class Win32_DesktopMonitor -ComputerName $ComputerName
   $lbl_sysinfo.Text = $Monitor | FL -Property DeviceID,
                                               Name,
                                               MonitorManufacturer,
                                               MonitorType,
                                               PixelsPerXLogicalInch,
                                               PixelPerYLogicalInch,
                                               ScreenHeight,
                                               ScreenWidth,
                                               Status | Out-String}
$OS_info = {
   $ComputerName = $txt_ComputerName.Text
   $OS = Get-CimInstance -Class Win32_OperatingSystem -ComputerName $ComputerName
   $lbl_sysinfo.Text = $OS | FL -Property Name,
                                          Manufacturer,
                                          Caption,
                                          Version,
                                          MUILanguages,
                                          BuildNumber,
                                          BuildType,
                                          InstallDate,
                                          OSArchitecture,
                                          PortableOperatingSystem,
                                          Primary,
                                          BootDevice,
                                          LastBootUpTime,
                                          LocalDateTime,
                                          CurrentTimeZone,
                                          RegisteredUser,
                                          SerialNumber,
                                          SystemDevice,
                                          SystemDirectory,
                                          SystemDrive,
                                          WindowsDirectory,
                                          EncryptionLevel,
                                          FreePhysicalMemory,
                                          FreeSpaceInPagingFiles,
                                          FreeVirtualMemory,
                                          SizeStoredInPagingFiles,
                                          TotalVirtualMemorySize,
                                          TotalVisibleMemorySize,
                                          Status | Out-String}
$Keyboard_info = {
   $ComputerName = $txt_ComputerName.Text
   $Keyboard = Get-CimInstance -Class Win32_Keyboard -ComputerName $ComputerName
   $lbl_sysinfo.Text = $Keyboard | FL -Property Description,
                                                Caption,
                                                NumberOfFunctionKeys | Out-String}
$Mouse_info = {
   $ComputerName = $txt_ComputerName.Text
   $Mouse = Get-CimInstance -Class Win32_PointingDevice -ComputerName $ComputerName
   $lbl_sysinfo.Text = $Mouse | FL -Property Description,
                                             Name,
                                             HardwareType,
                                             Manufacturer | Out-String}
$CDROM_info = {
   $ComputerName = $txt_ComputerName.Text
   $CDROM = Get-CimInstance -Class Win32_CDROMDrive -ComputerName $ComputerName
   $lbl_sysinfo.Text = $CDROM | FL -Property Drive,
                                             Name,
                                             Caption,
                                             Description,
                                             Manufacturer,
                                             MediaType,
                                             MfrAssignedRevisionLevel,
                                             CapabilityDescriptions,
                                             MediaLoaded | Out-String}
$Sound_info = {
   $ComputerName = $txt_ComputerName.Text
   $Sound = Get-CimInstance -Class Win32_SoundDevice -ComputerName $ComputerName
   $lbl_sysinfo.Text = $Sound | FL -Property DeviceID,
                                             Name,
                                             Manufacturer,
                                             ProductName | Out-String}
$Printers_info = {
   $ComputerName = $txt_ComputerName.Text
   $Printers = Get-CimInstance -Class Win32_Printer -ComputerName $ComputerName
   $lbl_sysinfo.Text = $Printers | FL -Property DeviceID,
                                                Name,
                                                HorizontalResolution,
                                                VerticalResolution,
                                                Default,
                                                DriverName,
                                                Direct,
                                                Network,
                                                Local,
                                                Hidden,
                                                KeepPrintedJobs,
                                                PrintJobDataType,
                                                PrintProcessor,
                                                PortName,
                                                Shared,
                                                ServerName,
                                                SpoolEnabled,
                                                WorkOffline,
                                                CapabilityDescriptions,
                                                Status | Out-String}
$Fan_info = {
   $ComputerName = $txt_ComputerName.Text
   $Fan = Get-CimInstance -Class Win32_Fan -ComputerName $ComputerName
   $lbl_sysinfo.Text = $Fan | FL -Property Name,
                                           Caption,
                                           Description,
                                           InstallDate,
                                           ActiveCooling,
                                           DesiredSpeed,
                                           VariableSpeed | Out-String}
$Battery_info = {
   $ComputerName = $txt_ComputerName.Text
   $Battery = Get-CimInstance -Class Win32_Battery -ComputerName $ComputerName
   $lbl_sysinfo.Text = $Battery | FL -Property * | Out-String}
$PortBattery_info = {
   $ComputerName = $txt_ComputerName.Text
   $PortBattery = Get-CimInstance -Class Win32_Battery -ComputerName $ComputerName
   $lbl_sysinfo.Text = $PortBattery | FL -Property * | Out-String}
$Software_info = {
   $ComputerName = $txt_ComputerName.Text
   $Product = {
      $Warning = [System.Windows.MessageBox]::Show('Are you sure that you want to run this using Win32_Product class?','Warning','YesNo','Error')
      switch ($Warning){
         Yes {$SoftwareOption.Close()
              $Software = Get-CimInstance -Class Win32Reg_Product -ComputerName $ComputerName
              $lbl_sysinfo.Text = $Software | FL -Property Name,
                                                           Version,
                                                           Description,
                                                           Vendor,
                                                           InstallDate,
                                                           InstallLocation,
                                                           HelpLink,
                                                           URLInfoAbout,
                                                           URLUpdateInfo | Out-String}
         No {Break}
      }
   }
   $AddRemove = {
      $SoftwareOption.Close()
      $Software = Get-CimInstance -Class Win32Reg_AddRemovePrograms -ComputerName $ComputerName
      $lbl_sysinfo.Text = $Software | FL -Property DisplayName,
                                                   InstallDate,
                                                   Publisher,
                                                   Version | Out-String}
   $SoftwareOption = New-Object system.Windows.Forms.Form
   $SoftwareOption.Text = "Class Option"
   $SoftwareOption.Size = New-Object System.Drawing.Size(500,130)
   $SoftwareOption.AutoSize = $False
   $SoftwareOption.AutoScroll = $False
   $SoftwareOption.MinimizeBox = $False
   $SoftwareOption.MaximizeBox = $False
   $SoftwareOption.WindowState = "Normal"
   $SoftwareOption.SizeGripStyle = "Hide"
   $SoftwareOption.ShowInTaskbar = $True
   $SoftwareOption.Opacity = 1
   $SoftwareOption.FormBorderStyle = "Fixed3D"
   $SoftwareOption.StartPosition = "CenterScreen"
   $lbl_SoftwareOption = New-Object System.Windows.Forms.Label
   $lbl_SoftwareOption.Location = New-Object System.Drawing.Point(20,10)
   $lbl_SoftwareOption.Size = New-Object System.Drawing.Size(500,25)
   $lbl_SoftwareOption.Text = "Please select the class that you want to use:"
   $lbl_SoftwareOption.Font = $Font
   $SoftwareOption.Controls.Add($lbl_SoftwareOption)
   $btn_Product = New-Object System.Windows.Forms.Button
   $btn_Product.Location = New-Object System.Drawing.Point(10,50)
   $btn_Product.Size = New-Object System.Drawing.Size(230,25)
   $btn_Product.Text = "Win32_Product"
   $btn_Product.Font = $Font
   $btn_Product.Add_Click($Product)
   $SoftwareOption.Controls.Add($btn_Product)
   $btn_AddRemove = New-Object System.Windows.Forms.Button
   $btn_AddRemove.Location = New-Object System.Drawing.Point(250,50)
   $btn_AddRemove.Size = New-Object System.Drawing.Size(230,25)
   $btn_AddRemove.Text = "Win32_AddRemovePrograms"
   $btn_AddRemove.Font = $Font
   $btn_AddRemove.Add_Click($AddRemove)
   $SoftwareOption.Controls.Add($btn_AddRemove)
   $SoftwareOption.ShowDialog()
}
$Process_info = {
   $ComputerName = $txt_ComputerName.Text
   $Process = Get-CimInstance -Class Win32_Process -ComputerName $ComputerName
   $lbl_sysinfo.Text = $Process | FL -Property ProcessName,
                                               Path,
                                               CreationDate | Out-String}
$Services_info = {
   $ComputerName = $txt_ComputerName.Text
   $Services = Get-CimInstance -Class Win32_Service -ComputerName $ComputerName
   $lbl_sysinfo.Text = $Services | FL -Property Name,
                                                DisplayName,
                                                Description,
                                                StartMode,
                                                Started,
                                                State,
                                                PathName | Out-String}
$Ping_Test_info = {
   $ComputerName = $txt_ComputerName.Text
   If ($ComputerName -eq ""){
      $lbl_sysinfo.ForeColor = "Red"
      $lbl_sysinfo.Text = "Please provide a computer name to test the connection"}
   else {
      $Ping_Test = Test-Connection $ComputerName
      $lbl_sysinfo.Text = $Ping_Test | Out-String}}
$RDP_Connection = {
   $ComputerName = $txt_ComputerName.Text
   mstsc /v:$ComputerName}
Add-Type -AssemblyName System.Windows.Forms
$Font = New-Object System.Drawing.Font("Consolas",12,[System.Drawing.FontStyle]::Regular)
$MainForm = New-Object system.Windows.Forms.Form
$MainForm.Text = "Computer Information"
$MainForm.Size = New-Object System.Drawing.Size(1200,800)
$MainForm.AutoScroll = $True
$MainForm.MinimizeBox = $True
$MainForm.MaximizeBox = $True
$MainForm.WindowState = "Normal"
$MainForm.SizeGripStyle = "Hide"
$MainForm.ShowInTaskbar = $True
$MainForm.Opacity = 1
$MainForm.StartPosition = "CenterScreen"
$MainForm.ShowInTaskbar = $True
$MainForm.Font = $Font
$lbl_ComputerName = New-Object System.Windows.Forms.Label
$lbl_ComputerName.Location = New-Object System.Drawing.Point(0,5)
$lbl_ComputerName.Size = New-Object System.Drawing.Size(150,20)
$lbl_ComputerName.Font = $Font
$lbl_ComputerName.Text = "Computer Name"
$MainForm.Controls.Add($lbl_ComputerName)
$lbl_sysinfo = New-Object System.Windows.Forms.Label
$lbl_sysinfo.Location = New-Object System.Drawing.Point(155,50)
$lbl_sysinfo.Size = New-Object System.Drawing.Size(500,500)
$lbl_sysinfo.AutoSize = $True
$lbl_sysinfo.Font = $Font
$lbl_sysinfo.Text = ""
$MainForm.Controls.Add($lbl_sysinfo)
$txt_ComputerName = New-Object System.Windows.Forms.TextBox
$txt_ComputerName.Location = New-Object System.Drawing.Point(150,5)
$txt_ComputerName.Size = New-Object System.Drawing.Size(200,20)
$txt_ComputerName.Font = $Font
$MainForm.Controls.Add($txt_ComputerName)
$btn_System = New-Object System.Windows.Forms.Button
$btn_System.Location = New-Object System.Drawing.Point(5,50)
$btn_System.Size = New-Object System.Drawing.Size(145,25)
$btn_System.Font = $Font
$btn_System.Text = "System"
$btn_System.Add_Click($System_info)
$MainForm.Controls.Add($btn_System)
$btn_BIOS = New-Object System.Windows.Forms.Button
$btn_BIOS.Location = New-Object System.Drawing.Point(5,75)
$btn_BIOS.Size = New-Object System.Drawing.Size(145,25)
$btn_BIOS.Font = $Font
$btn_BIOS.Text = "BIOS"
$btn_BIOS.Add_Click($bios_info)
$MainForm.Controls.Add($btn_BIOS)
$btn_CPU = New-Object System.Windows.Forms.Button
$btn_CPU.Location = New-Object System.Drawing.Point(5,100)
$btn_CPU.Size = New-Object System.Drawing.Size(145,25)
$btn_CPU.Font = $Font
$btn_CPU.Text = "CPU"
$btn_CPU.Add_Click($cpu_info)
$MainForm.Controls.Add($btn_CPU)
$btn_RAM = New-Object System.Windows.Forms.Button
$btn_RAM.Location = New-Object System.Drawing.Point(5,125)
$btn_RAM.Size = New-Object System.Drawing.Size(145,25)
$btn_RAM.Font = $Font
$btn_RAM.Text = "RAM"
$btn_RAM.Add_Click($ram_info)
$MainForm.Controls.Add($btn_RAM)
$btn_MB = New-Object System.Windows.Forms.Button
$btn_MB.Location = New-Object System.Drawing.Point(5,150)
$btn_MB.Size = New-Object System.Drawing.Size(145,25)
$btn_MB.Font = $Font
$btn_MB.Text = "Motherboard"
$btn_MB.Add_Click($mb_info)
$MainForm.Controls.Add($btn_MB)
$btn_PhysicalDrives = New-Object System.Windows.Forms.Button
$btn_PhysicalDrives.Location = New-Object System.Drawing.Point(5,175)
$btn_PhysicalDrives.Size = New-Object System.Drawing.Size(145,25)
$btn_PhysicalDrives.Font = $Font
$btn_PhysicalDrives.Text = "Physical Drives"
$btn_PhysicalDrives.Add_Click($PhysicalDrives_info)
$MainForm.Controls.Add($btn_PhysicalDrives)
$btn_LogicalDrives = New-Object System.Windows.Forms.Button
$btn_LogicalDrives.Location = New-Object System.Drawing.Point(5,200)
$btn_LogicalDrives.Size = New-Object System.Drawing.Size(145,25)
$btn_LogicalDrives.Font = $Font
$btn_LogicalDrives.Text = "Logical Drives"
$btn_LogicalDrives.Add_Click($LogicalDrives_info)
$MainForm.Controls.Add($btn_LogicalDrives)
$btn_Graphics = New-Object System.Windows.Forms.Button
$btn_Graphics.Location = New-Object System.Drawing.Point(5,225)
$btn_Graphics.Size = New-Object System.Drawing.Size(145,25)
$btn_Graphics.Font = $Font
$btn_Graphics.Text = "Graphics"
$btn_Graphics.Add_Click($GPU_info)
$MainForm.Controls.Add($btn_Graphics)
$btn_Network = New-Object System.Windows.Forms.Button
$btn_Network.Location = New-Object System.Drawing.Point(5,250)
$btn_Network.Size = New-Object System.Drawing.Size(145,25)
$btn_Network.Font = $Font
$btn_Network.Text = "Network"
$btn_Network.Add_Click($Network_info)
$MainForm.Controls.Add($btn_Network)
$btn_NetSettings = New-Object System.Windows.Forms.Button
$btn_NetSettings.Location = New-Object System.Drawing.Point(5,275)
$btn_NetSettings.Size = New-Object System.Drawing.Size(145,25)
$btn_NetSettings.Font = $Font
$btn_NetSettings.Text = "Net Settings"
$btn_NetSettings.Add_Click($NetSettings_info)
$MainForm.Controls.Add($btn_NetSettings)
$btn_Monitors = New-Object System.Windows.Forms.Button
$btn_Monitors.Location = New-Object System.Drawing.Point(5,300)
$btn_Monitors.Size = New-Object System.Drawing.Size(145,25)
$btn_Monitors.Font = $Font
$btn_Monitors.Text = "Monitors"
$btn_Monitors.Add_Click($Monitor_info)
$MainForm.Controls.Add($btn_Monitors)
$btn_OS = New-Object System.Windows.Forms.Button
$btn_OS.Location = New-Object System.Drawing.Point(5,325)
$btn_OS.Size = New-Object System.Drawing.Size(145,25)
$btn_OS.Font = $Font
$btn_OS.Text = "OS"
$btn_OS.Add_Click($OS_info)
$MainForm.Controls.Add($btn_OS)
$btn_Keyboard = New-Object System.Windows.Forms.Button
$btn_Keyboard.Location = New-Object System.Drawing.Point(5,350)
$btn_Keyboard.Size = New-Object System.Drawing.Size(145,25)
$btn_Keyboard.Font = $Font
$btn_Keyboard.Text = "Keyboard"
$btn_Keyboard.Add_Click($Keyboard_info)
$MainForm.Controls.Add($btn_Keyboard)
$btn_Mouse = New-Object System.Windows.Forms.Button
$btn_Mouse.Location = New-Object System.Drawing.Point(5,375)
$btn_Mouse.Size = New-Object System.Drawing.Size(145,25)
$btn_Mouse.Font = $Font
$btn_Mouse.Text = "Mouse"
$btn_Mouse.Add_Click($Mouse_info)
$MainForm.Controls.Add($btn_Mouse)
$btn_CDROM = New-Object System.Windows.Forms.Button
$btn_CDROM.Location = New-Object System.Drawing.Point(5,400)
$btn_CDROM.Size = New-Object System.Drawing.Size(145,25)
$btn_CDROM.Font = $Font
$btn_CDROM.Text = "CDROM"
$btn_CDROM.Add_Click($CDROM_info)
$MainForm.Controls.Add($btn_CDROM)
$btn_Sound = New-Object System.Windows.Forms.Button
$btn_Sound.Location = New-Object System.Drawing.Point(5,425)
$btn_Sound.Size = New-Object System.Drawing.Size(145,25)
$btn_Sound.Font = $Font
$btn_Sound.Text = "Sound"
$btn_Sound.Add_Click($Sound_info)
$MainForm.Controls.Add($btn_Sound)
$btn_Printers = New-Object System.Windows.Forms.Button
$btn_Printers.Location = New-Object System.Drawing.Point(5,450)
$btn_Printers.Size = New-Object System.Drawing.Size(145,25)
$btn_Printers.Font = $Font
$btn_Printers.Text = "Printers"
$btn_Printers.Add_Click($Printers_info)
$MainForm.Controls.Add($btn_Printers)
$btn_Fan = New-Object System.Windows.Forms.Button
$btn_Fan.Location = New-Object System.Drawing.Point(5,475)
$btn_Fan.Size = New-Object System.Drawing.Size(145,25)
$btn_Fan.Font = $Font
$btn_Fan.Text = "Fan"
$btn_Fan.Add_Click($Fan_info)
$MainForm.Controls.Add($btn_Fan)
$btn_Battery = New-Object System.Windows.Forms.Button
$btn_Battery.Location = New-Object System.Drawing.Point(5,500)
$btn_Battery.Size = New-Object System.Drawing.Size(145,25)
$btn_Battery.Font = $Font
$btn_Battery.Text = "Battery"
$btn_Battery.Add_Click($Battery_info)
$MainForm.Controls.Add($btn_Battery)
$btn_PortBattery = New-Object System.Windows.Forms.Button
$btn_PortBattery.Location = New-Object System.Drawing.Point(5,525)
$btn_PortBattery.Size = New-Object System.Drawing.Size(145,25)
$btn_PortBattery.Font = $Font
$btn_PortBattery.Text = "Port Battery"
$btn_PortBattery.Add_Click($PortBattery_info)
$MainForm.Controls.Add($btn_PortBattery)
$btn_Software = New-Object System.Windows.Forms.Button
$btn_Software.Location = New-Object System.Drawing.Point(5,550)
$btn_Software.Size = New-Object System.Drawing.Size(145,25)
$btn_Software.Font = $Font
$btn_Software.Text = "Software"
$btn_Software.Add_Click($Software_info)
$MainForm.Controls.Add($btn_Software)
$btn_Process = New-Object System.Windows.Forms.Button
$btn_Process.Location = New-Object System.Drawing.Point(5,575)
$btn_Process.Size = New-Object System.Drawing.Size(145,25)
$btn_Process.Font = $Font
$btn_Process.Text = "Process"
$btn_Process.Add_Click($Process_info)
$MainForm.Controls.Add($btn_Process)
$btn_Services = New-Object System.Windows.Forms.Button
$btn_Services.Location = New-Object System.Drawing.Point(5,600)
$btn_Services.Size = New-Object System.Drawing.Size(145,25)
$btn_Services.Font = $Font
$btn_Services.Text = "Services"
$btn_Services.Add_Click($Services_info)
$MainForm.Controls.Add($btn_Services)
$btn_Ping = New-Object System.Windows.Forms.Button
$btn_Ping.Location = New-Object System.Drawing.Point(5,625)
$btn_Ping.Size = New-Object System.Drawing.Size(145,25)
$btn_Ping.Font = $Font
$btn_Ping.Text = "Ping Test"
$btn_Ping.Add_Click($Ping_Test_info)
$MainForm.Controls.Add($btn_Ping)
$btn_RDP = New-Object System.Windows.Forms.Button
$btn_RDP.Location = New-Object System.Drawing.Point(5,650)
$btn_RDP.Size = New-Object System.Drawing.Size(145,25)
$btn_RDP.Font = $Font
$btn_RDP.Text = "RDP"
$btn_RDP.Add_Click($RDP_Connection)
$MainForm.Controls.Add($btn_RDP)
$MainForm.ShowDialog
Summary
How to get remote system information - Part 2
Article Name
How to get remote system information - Part 2
Description
How to get remote system information with PowerShell. Getting remote computer or server information has never been easier with this PowerShell script and it GUI. Stephanos Constantinou Blog - PowerShell Scripting
Author
Stephanos
Publisher Name
Stephanos Constantinou Blog
Publisher Logo
Stephanos Constantinou Blog

Filed Under: PowerShell Scripts Tagged With: Add-Type, Get-CimInstance, New-Object, Out-String, Win32_BaseBoard, Win32_Battery, Win32_Bios, Win32_CDROMDrive, Win32_ComputerSystem, Win32_DesktopMonitor, Win32_DiskDrive, Win32_Fan, Win32_Keyboard, Win32_LogicalDisk, Win32_NetworkAdapter, Win32_NetworkAdapterConfiguration, Win32_OperatingSystem, Win32_PhysicalMemory, Win32_PointingDevice, Win32_PortableBattery, Win32_Printer, Win32_Process, Win32_Processor, Win32_Product, Win32_Service, Win32_SoundDevice, Win32_VideoController, Win32Reg_AddRemovePrograms

Reader Interactions

Comments

  1. rcjay272 says

    12/03/2018 at 02:32

    Stephanos,

    Just found your site and this post. I’ve been wanting to create a GUI for several of my scripts and this fits perfectly.
    One question I have is on the creation of the GUI how do you go about designing it?
    Meaning…Do you have an idea of what you want to gather then mock up the button layout first? I looking for help in the design.
    While playing around I found for some of my examples I started from scratch and then moved to building the button structure and finally adding the code for each specific button.

    Is there a better way to design the GUI? What is your process?

    Thanks again for the script example…it was easy to follow and understand.
    Rob.

    Reply
    • Stephanos says

      13/03/2018 at 14:32

      Hello Rob,

      Thank you for your comments.

      When I have a GUI in my scripts, I usually draw a layout based on what I would like to achieve and then I proceed with the coding for the UI and button actions at the same time. If any changes are needed during the process, I act accordingly. I don’t know if this is the correct procedure as I am not a UI expert, but it works for me.

      Thank you
      Stephanos

      Reply

Trackbacks

  1. How to get remote system information - Part 2 - How to Code .NET says:
    26/02/2018 at 19:00

    […] on February 25, 2018by admin submitted by /u/SConstantinou [link] [comments] No comments […]

    Reply
  2. How to get remote system information - Part 1 - Stephanos Constantinou says:
    06/03/2018 at 10:24

    […] How to get remote system information – Part 2 – Stephanos Constantinou says: 26/02/2018 at 16:22 […]

    Reply
  3. How to get remote system information - Part 3 - Stephanos Constantinou says:
    14/03/2018 at 17:34

    […] How to get remote system information – Part 2 […]

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Footer

Recent Posts

  • ICS Cube Product Review 26/04/2019
  • PowerShell Module SysInfo v1.2.0 15/03/2019
  • PowerShell Module SysInfo v1.1.2 13/11/2018
  • PowerShell Module SysInfo 24/10/2018
  • Get-VoltageProbe 24/10/2018
  • Get-VideoController 24/10/2018
  • Get-USBController 24/10/2018
  • Get-TrackPoint 24/10/2018
  • Get-TrackBall 24/10/2018
  • Get-TouchScreen 24/10/2018
Planet PowerShell

Categories

  • Modules Cmdlets (57)
  • PowerShell Modules (5)
  • PowerShell Scripts (38)
  • PowerShell Tutorials (35)
  • Software Reviews (2)

Archives

  • April 2019 (1)
  • March 2019 (1)
  • November 2018 (1)
  • October 2018 (56)
  • September 2018 (13)
  • August 2018 (9)
  • July 2018 (6)
  • June 2018 (8)
  • May 2018 (7)
  • April 2018 (9)
  • March 2018 (4)
  • February 2018 (6)
  • January 2018 (12)
  • December 2017 (4)
Top 10 PowerShell 2018

Blogroll

  • Planet PowerShell
  • Reddit – PowerShell
  • PowerShell Magazine
  • PowerShell.org
  • PowerShell Team Blog
  • Hey, Scripting Guy! Blog
  • Mike F Robbins
  • PowerShell Explained with Kevin Marquette
  • Mike Kanakos – Network Admin
  • The Lonely Administrator
  • AskME4Tech
PowerShell Blogs Sysadmin Blogs Banners for Top 20 Programming Blogs

© 2023 · Stephanos Constantinou Blog

  • Home
  • Blogs
  • About
  • Contact