MoonPoint Support Logo

 


Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals



Advanced Search
October
Sun Mon Tue Wed Thu Fri Sat
17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
2017
Months
OctNov Dec


Fri, Oct 13, 2017 10:59 pm

Checking the uptime for a Windows system using PowerShell

If you want to determine how long a Microsoft system has been running since it was last rebooted from a command-line interface (CLI), you can do so using PowerShell. You can do so by subtracting the last boot time from the current date and time. The Get-Date cmdlet shows the current date and time and (Get-CimInstance Win32_OperatingSystem).LastBootUpTime shows the last time the system was booted.

PS C:\Users\public\documents> (Get-CimInstance Win32_OperatingSystem).LastBootUpTime

Tuesday, October 10, 2017 9:12:14 PM


PS C:\Users\public\documents> (Get-Date) - (Get-CimInstance Win32_OperatingSystem).LastBootUpTime


Days              : 3
Hours             : 1
Minutes           : 29
Seconds           : 26
Milliseconds      : 717
Ticks             : 2645667172021
TotalDays         : 3.06211478243171
TotalHours        : 73.4907547783611
TotalMinutes      : 4409.44528670167
TotalSeconds      : 264566.7172021
TotalMilliseconds : 264566717.2021



PS C:\Users\public\documents>

You can use the alias GCIM for Get-CimInstance to save some typing, if you wish.

PS C:\Users\public\documents> (GCIM Win32_OperatingSystem).LastBootUpTime

Tuesday, October 10, 2017 9:12:14 PM


PS C:\Users\public\documents>

[/os/windows/PowerShell] permanent link

Tue, Oct 10, 2017 11:31 pm

Wget and curl functionality via PowerShell on a Windows system

If you are accustomed to using the wget or cURL utilities on Linux or Mac OS X to download webpages from a command-line interface (CLI), there is a Gnu utility, Wget for Windows , that you can download and use on systems running Microsoft Windows. Alternatively, you can use the Invoke-WebRequest cmdlet from a PowerShell prompt, if you have version 3.0 or greater of PowerShell on the system. You can determine the version of PowerShell on a system by opening a PowerShell window and typing $psversiontable. E.g., in the example below from a Windows 10 system, the version of PowerShell is 5.1.15063.674.

PS C:\Users\public\documents> $psversiontable

Name                           Value
----                           -----
PSVersion                      5.1.15063.674
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.15063.674
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1


PS C:\Users\public\documents>

If you have version 3.0 or later, you can use wget or curl as an alias for the Invoke-WebRequest cmdlet, at least up through version 5.x. E.g., if I want to download the home page for the website example.com to a file named index.html, I could use the command wget -OutFile index.html http://example.com at a PowerShell prompt. Or I could use either of the following commands, instead:

curl -OutFile index.html http://example.com
Invoke-WebRequest -OutFile index.html http://example.com

[ More Info ]

[/os/windows/PowerShell] permanent link

Mon, Oct 09, 2017 11:13 pm

Checking the version of a Dynamic Link Library (DLL) file

You can check version information for a Dynamic-link Library (DLL) file, i.e., a file with a .dll filename extension, or a executable file, i.e., a .exe file, from a command-line interface (CLI) on a Microsoft Windows system by using the Get-Item cmdlet. E.g.:

PS C:\> (Get-Item C:\Windows\explorer.exe).VersionInfo

ProductVersion   FileVersion      FileName
--------------   -----------      --------
10.0.15063.0     10.0.15063.0 ... C:\Windows\explorer.exe


PS C:\>

If you can't see all of the information, i.e., if you see three dots indicating that not all of the information is displayed, you can append | format-list to the command to have the output displayed in list format.

PS C:\> (Get-Item C:\Windows\explorer.exe).VersionInfo | format-list


OriginalFilename  : EXPLORER.EXE.MUI
FileDescription   : Windows Explorer
ProductName       : Microsoft® Windows® Operating System
Comments          :
CompanyName       : Microsoft Corporation
FileName          : C:\Windows\explorer.exe
FileVersion       : 10.0.15063.0 (WinBuild.160101.0800)
ProductVersion    : 10.0.15063.0
IsDebug           : False
IsPatched         : False
IsPreRelease      : False
IsPrivateBuild    : False
IsSpecialBuild    : False
Language          : English (United States)
LegalCopyright    : © Microsoft Corporation. All rights reserved.
LegalTrademarks   :
PrivateBuild      :
SpecialBuild      :
FileVersionRaw    : 10.0.15063.608
ProductVersionRaw : 10.0.15063.608



PS C:\>

[ More Info ]

[/os/windows/PowerShell] permanent link

Tue, Sep 05, 2017 10:55 pm

Using the PowerShell Get-WmiObject cmdlet to get BIOS information

You can get BIOS information on a system running the Microsoft Windows operating system using the PowerShell cmdlet Get-WmiObject cmdlet. E.g.

PS C:\> Get-WmiObject win32_bios


SMBIOSBIOSVersion : FB
Manufacturer      : Award Software International, Inc.
Name              : Award Modular BIOS v6.00PG
SerialNumber      :
Version           : GBT    - 42302e31



PS C:\>

[ More Info ]

[/os/windows/PowerShell] permanent link

Mon, Sep 04, 2017 10:42 pm

Obtaining monitor information from a PowerShell Prompt

If you need to know information about the manufacturer and model number of a monitor on a Microsoft Windows system, you may be able to obtain it from a PowerShell prompt using the Get-WmiObject cmdlet as shown below:

PS C:\> Get-WmiObject win32_desktopmonitor


DeviceID            : DesktopMonitor1
DisplayType         :
MonitorManufacturer : HP
Name                : HP S2031 Series Wide LCD Monitor
ScreenHeight        :
ScreenWidth         :



PS C:\>

[ More Info ]

[/os/windows/PowerShell] permanent link

Fri, Sep 01, 2017 11:06 pm

PowerShell Get-Printer Cmdlet

If you want to know what options you have for printing files on a Microsoft Windows system, e.g., perhaps you want a list of currently avaialble printers or even want to know the IP addresses by which some printers are accessible, the PowerShell Get-Printer cmdlet may provide the information you are seeking. E.g.:

PS C:\Users\Pam> Get-Printer

Name                           ComputerName    Type         DriverName                PortName        Shared   Published
----                           ------------    ----         ----------                --------        ------   ---------
Microsoft XPS Document Writ...                 Local        Remote Desktop Easy Print TS002           False    False
Send To OneNote 2013 (redir...                 Local        Remote Desktop Easy Print TS003           False    False
Quicken PDF Printer (redire...                 Local        Remote Desktop Easy Print TS001           False    False
Send To OneNote 2010                           Local        Send To Microsoft OneN... nul:            False    False
Ricoh Aficio MP C2500 PCL5c                    Local        Ricoh Aficio MP C2500 ... 192.168.0.90    True     False
Microsoft XPS Document Writer                  Local        Microsoft XPS Document... PORTPROMPT:     False    False
Microsoft Print to PDF                         Local        Microsoft Print To PDF    PORTPROMPT:     False    False
HP Deskjet 6940 series                         Local        HP Deskjet 6940 series    192.168.0.9     True     False
Fax                                            Local        Microsoft Shared Fax D... SHRFAX:         False    False
Adobe PDF                                      Local        Adobe PDF Converter       Documents\*.pdf False    False
ABS PDF Driver v400                            Local        Amyuni Document Conver... LPT1:           False    False


PS C:\Users\Pam>

[ More Info ]

[/os/windows/PowerShell] permanent link

Thu, Aug 17, 2017 11:09 pm

Obtaining information on a system's motherboard with PowerShell

You can obtain information on the motherboard in a computer running Microsoft Windows using PowerShell by means of the Get-Ciminstance cmdlet with the command Get-Ciminstance Win32_Baseboard. E.g., the following example is from a Microsoft Windows 10 system.

PS C:\> get-ciminstance win32_baseboard


Manufacturer : Gigabyte Technology Co., Ltd.
Model        :
Name         : Base Board
SerialNumber :
SKU          :
Product      : GA-78LMT-S2P



PS C:\>

The manufacturer, model number, serial number, SKU, and product number will be displayed if that information can be queried from the motherboard. Note: not all parameters will be available for every motherboard as shown above. For another system, the serial number is available.

PS C:\> get-ciminstance win32_baseboard


Manufacturer : Dell Inc.
Model        :
Name         : Base Board
SerialNumber : .7XCTZ12.CN7016346F0331.
SKU          :
Product      : 088DT1



PS C:\>

You can restrict the displayed information to particular parameters by piping the output to select-object. E.g.:

PS C:\> get-ciminstance win32_baseboard | select-object manufacturer

manufacturer
------------
Gigabyte Technology Co., Ltd.


PS C:\> get-ciminstance win32_baseboard | select-ojbect manufacturer, product

manufacturer                  product
------------                  -------
Gigabyte Technology Co., Ltd. GA-78LMT-S2P


PS C:\>

Another command line alternative to using PowerShell is to use WMIC to determine motherboard information.

[/os/windows/PowerShell] permanent link

Thu, Aug 10, 2017 9:26 pm

Using PowerShell to obtain process information

You can use the Get-CimInstance cmdlet at a PowerShell prompt to obtain information on processes running on a Microsoft Windows system. E.g., to see a list of all the processes currently running on a system, the command gcim win32_process can be used; gcim is an alias for Get-CimInstance, so you can use the shorter alias or Get-CimInstance. The name of the process, its process identifier (PID), handle count, working set size, and virtual memory size are displayed.

[ More Info ]

[/os/windows/PowerShell] permanent link

Sat, Aug 05, 2017 10:47 pm

List Installed Security Patches with PowerShell

If you want to know which security patches were installed on a Microsoft Windows system within a specific time period, e.g., the last month or the last 3 months, you can use a Get-CimInstance command in a PowerShell window. E.g.:

PS C:\Users\Lila> Get-CimInstance -Class win32_quickfixengineering | Where-Object { $_.InstalledOn -gt (Get-Date).AddMonths(-1) }

Source        Description      HotFixID      InstalledBy          InstalledOn
------        -----------      --------      -----------          -----------
              Security Update  KB4025376     NT AUTHORITY\SYSTEM  7/12/2017 12:00:00 AM
              Security Update  KB4025342     NT AUTHORITY\SYSTEM  7/12/2017 12:00:00 AM


PS C:\Users\Lila> Get-CimInstance -Class win32_quickfixengineering | Where-Object { $_.InstalledOn -gt (Get-Date).AddMonths(-3) }

Source        Description      HotFixID      InstalledBy          InstalledOn
------        -----------      --------      -----------          -----------
              Security Update  KB4020821     NT AUTHORITY\SYSTEM  6/17/2017 12:00:00 AM
              Update           KB4021572     NT AUTHORITY\SYSTEM  6/17/2017 12:00:00 AM
              Update           KB4022405     NT AUTHORITY\SYSTEM  6/17/2017 12:00:00 AM
              Security Update  KB4025376     NT AUTHORITY\SYSTEM  7/12/2017 12:00:00 AM
              Security Update  KB4025342     NT AUTHORITY\SYSTEM  7/12/2017 12:00:00 AM


PS C:\Users\Lila>

[ More Info ]

[/os/windows/PowerShell] permanent link

Mon, Mar 06, 2017 11:28 pm

Finding files modified before or after a certain date with PowerShell

On a Microsoft Windows system, you can find files created before or after a specified date using the Get-ChildItem cmdlet. To use the cmdlet, open a PowerShell window - you can do so on a Windows 10 system by typing powershell in the Cortana "Ask me anything" window, hitting Enter, and then clicking on Windows PowerShell, which should be returned as the best match. If you wish to find files and directories before a certain date, you can use a command in the form Get-ChildItem | Where-Object {$_.LastWriteTime -lt date where date is the relevant date. E.g., on a system that uses the date format of mm/dd/yyyy where mm represents the month, dd the day and yyyy the year, a command like the one shown below, which returns a list of the files with a modification time prior to January 1, 2013, can be used:

PS C:\Users\Lila\documents> Get-ChildItem | Where-Object {$_.LastWriteTime -lt '1/1/2013'}


    Directory: C:\Users\Lila\documents


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----         9/9/2012  10:36 PM                Book Collector
d-----        11/8/2012   8:25 AM                Corel PaintShop Pro
d-----         4/6/2012   2:37 PM                recovered
-a----        4/14/2012   4:16 PM      761476464 Disc1.bin
-a----        4/14/2012   4:16 PM            941 Disc1.cue


PS C:\Users\Lila\documents>

[ More Info ]

[/os/windows/PowerShell] permanent link

Once You Know, You Newegg AliExpress by Alibaba.com

Shop Amazon Local - Subscribe to Deals in Your Neighborhood

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo