Get-WmiObject Win32_OperatingSystem | select Version SystemEnvironment]::OSVersion in .NET framework

Maker Code-39 in .NET framework Get-WmiObject Win32_OperatingSystem | select Version SystemEnvironment]::OSVersion
Get-WmiObject Win32_OperatingSystem | select Version SystemEnvironment]::OSVersion
Draw Code 3 Of 9 In VS .NET
Using Barcode encoder for VS .NET Control to generate, create USS Code 39 image in VS .NET applications.
The WMI class Win32_Bios delivers information about BIOS:
Code 39 Reader In Visual Studio .NET
Using Barcode decoder for .NET framework Control to read, scan read, scan image in .NET framework applications.
Get-WmiObject win32_Bios
Bar Code Printer In Visual Studio .NET
Using Barcode drawer for .NET framework Control to generate, create barcode image in .NET applications.
The boot con guration can be found in the WMI class Win32_ BootCon guration:
Decoding Bar Code In Visual Studio .NET
Using Barcode reader for .NET framework Control to read, scan read, scan image in Visual Studio .NET applications.
Get-WmiObject Win32_BootCon guration
Code 39 Creation In C#.NET
Using Barcode maker for Visual Studio .NET Control to generate, create ANSI/AIM Code 39 image in .NET applications.
The Windows system directory is again in the NET class System
Draw Code 39 Extended In VS .NET
Using Barcode maker for ASP.NET Control to generate, create Code 39 Full ASCII image in ASP.NET applications.
Environment:
Making Code 39 In VB.NET
Using Barcode generator for .NET framework Control to generate, create Code-39 image in .NET applications.
"System Directory: "+ [SystemEnvironment]::SystemDirectory
Generate UPC-A Supplement 5 In .NET
Using Barcode printer for VS .NET Control to generate, create Universal Product Code version A image in Visual Studio .NET applications.
You will nd the status of the Windows product activation in the following:
Barcode Encoder In .NET Framework
Using Barcode drawer for VS .NET Control to generate, create bar code image in .NET applications.
Get-WmiObject Win32_WindowsProductActivation
Code128 Printer In Visual Studio .NET
Using Barcode creator for .NET framework Control to generate, create Code 128 Code Set B image in VS .NET applications.
Computer Settings
Barcode Maker In .NET
Using Barcode generation for VS .NET Control to generate, create barcode image in VS .NET applications.
There is also data about the selected recovery options of the Windows software:
Generate Planet In .NET Framework
Using Barcode encoder for VS .NET Control to generate, create USPS Confirm Service Barcode image in .NET applications.
Get-WmiObject Win32_OSRecoveryCon guration
DataMatrix Generator In Visual C#.NET
Using Barcode printer for .NET framework Control to generate, create Data Matrix ECC200 image in .NET framework applications.
You can display the environment variables via the Windows PowerShell (WPS) drive env (see Figure 151):
Making Barcode In Java
Using Barcode printer for Java Control to generate, create barcode image in Java applications.
dir env:
Painting Code 39 Full ASCII In .NET Framework
Using Barcode generator for ASP.NET Control to generate, create Code-39 image in ASP.NET applications.
Information about a single environment variable can be fetched by adding the name of the environment variable to the path, as follows:
Reading GTIN - 12 In Visual Studio .NET
Using Barcode reader for VS .NET Control to read, scan read, scan image in Visual Studio .NET applications.
dir env:/Path
Data Matrix Creation In Java
Using Barcode drawer for Java Control to generate, create DataMatrix image in Java applications.
If you want to know only the content of an environment variable, you can use Get-Content:
Code 39 Full ASCII Encoder In Java
Using Barcode creation for Java Control to generate, create Code 39 image in Java applications.
Get-Content env:/Path
Barcode Decoder In Java
Using Barcode decoder for Java Control to read, scan read, scan image in Java applications.
The value fetched by Get-Content can be saved in a variable and then used by this; for example, for splitting a path string with the help of the Split() method from the NET class SystemString:
ECC200 Creation In VS .NET
Using Barcode creator for ASP.NET Control to generate, create Data Matrix ECC200 image in ASP.NET applications.
$Pathe = Get-Content env:/Path $PatheSplit(";")
If you want to nd out how many les there are in the search paths of Windows, the following command is available:
(Get-Content env:/Path)Split(";") measure-object | Get-ChildItem |
15 COMPUTERS AND HARDWARE
15 Computers and Hardware
Figure 151 Listing of environment variables
Hardware
WPS 10 does not offer any commandlets for accessing hardware information Nevertheless, you can still refer to WMI Alternatively, you can access some functions via the wwwIT-Visionsde PowerShell Extensions (These were introduced 10, Tips, Tricks, and Troubleshooting ) Within WPS, you can get information about installed hardware via WMI (that is, by using the commandlet Get-WmiObject together with the respective WMI class; see Table 151)
Hardware
Table 151 Call of Hardware Information in WPS
Hardware Module WPS Command (Standard) Get-WmiObject Win32_Processor Get-WmiObject Win32_MemoryDevice Get-WmiObject Win32_VideoController Get-WmiObject Win32_SoundDevice Get-WmiObject Win32_Diskdrive Get-WmiObject Win32_Tapedrive Get-WmiObject Win32_CDRomdrive Get-WmiObject Win32_NetworkAdapter Get-WmiObject Win32_USBController Get-WmiObject Win32_Keyboard Get-WmiObject Win32_PointingDevice wwwIT-Visionsde PowerShell Extensions Get-Processor Get-MemoryDevice Get-Videocontroller
Processors Main memory Video controller Sound device Disks Tape drives CD/DVD drives Network adapters USB controller Keyboard Pointing device
Get-SoundDevice Get-Disk Get-Tapedrive Get-CDRomdrive Get-Networkadapter Get-USBController Get-Keyboard Get-PointingDevice
The number of processors on one system can also be obtained via the NET class SystemEnvironment:
15 COMPUTERS AND HARDWARE "Number of processors: " + [SystemEnvironment]::ProcessorCount
15 Computers and Hardware
Printers and Print Jobs
The command
Get-WmiObject Win32_Printer
displays a list of all available printers on the local system You can use the computername parameter to access a remote computer (see Figure 152) Printers that are mapped through a terminal services session have the text from in session in their name
Figure 152 Listing of all installed printers from a remote computer If you want to check the status of a printer, you should read printerstatus and detectederrorstate:
Get-WmiObject win32_printer | select name, printerstatus, detectederrorstate
Hardware
In Figure 153, we have the following values: 3 = ready, 1 = other, 5 = low toner
Figure 153 Checking the printer status
Printer Connections
If you want to install a network printer, you can use the static method AddPrinterConnection() in the Win32_Printer class:
$printer = [WMIClass]"\\\root\cimv2:Win32_Printer" $printerAddPrinterConnection("\\E02\Dell")
The method will return the value of 0 if the installation is successful
Print Jobs
15 COMPUTERS AND HARDWARE
To transfer information to the printer, you use the commandlet OutPrinter (alias lp) in WPS This commandlet has already been discussed in this book (see 3, Pipelining ) With
Get-WmiObject Win32_Printjob
you get all current print jobs on your local system (see Figure 154) Of course, you can use the computer parameter to query a remote system
15 Computers and Hardware
Figure 154 Using the print job script You can pause all print jobs for a distinct printer with the following command:
Get-WmiObject Win32_Printjob -Filter "Drivername='Dell 3115'" | Foreach-Object { $_Pause() }
You can resume them later by calling the method Resume() To cancel all jobs, you have to call the Delete() method (see Listing 151) Listing 151 Canceling All Print Jobs for a Certain Printer on a Speci c Print Server
"--- Print Jobs before:" Get-WmiObject Win32_Printjob -computer E01 -Filter "Drivername='Dell MFP Laser 3115cn PCL6'" "--- Canceling all Print Jobs"
Hardware
Get-WmiObject Win32_Printjob -computer E01 -Filter "Drivername='Dell MFP Laser 3115cn PCL6'" | Foreach-Object { $_Delete() } "--- Print Jobs after:" Get-WmiObject Win32_Printjob -computer E01 -Filter "Drivername='Dell MFP Laser 3115cn PCL6'"
TIP You could also call the CancelAllJobs() method of the Win32_ Printer object
MORE INFORMATION For additional information about printer administration, look at the WMI classes with the word Printer in their name (see Figure 155)