Posted: . At: 1:45 PM. This was 6 years ago. Post ID: 11798
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.

Some very useful Powershell tricks.

Print the current date and time with Powershell.

"{0:dddd - hh:mm:ss - d/M/yy}" -f (get-date)

This is an example of what this will give you.

PS C:\Users\jason> "{0:dddd - hh:mm:ss - d/M/yy}" -f (get-date)
Tuesday - 08:42:05 - 30/1/18

Get information about your operating system via the Powershell prompt.

PS C:\Users\jason> Get-CimInstance Win32_OperatingSystem | Select-Object  Caption, InstallDate, ServicePackMajo
rVersion, OSArchitecture, BootDevice,  BuildNumber, CSName | FL
 
 
Caption                 : Microsoft Windows 8.1 Pro
InstallDate             : 5/31/2017 09:02:33
ServicePackMajorVersion : 0
OSArchitecture          : 64-bit
BootDevice              : \Device\HarddiskVolume1
BuildNumber             : 9600
CSName                  : BLUFOR

Get a lot of information about your operating system with this command line.

PS C:\Users\Corporal Kerry> Get-CimInstance Win32_OperatingSystem | FL *

Print the Windows version.

PS C:\Users\Corporal Kerry> Get-CimInstance Win32_OperatingSystem | FL Caption
 
 
Caption : Microsoft Windows 8.1 Pro

Get the amount of free hard disk space with Powershell.

PS C:\Users\Corporal Kerry> Get-WMIObject Win32_Logicaldisk -filter "deviceid='C:'"
 
 
DeviceID     : C:
DriveType    : 3
ProviderName :
FreeSpace    : 723164770304
Size         : 1000202039296
VolumeName   :

Leave a Comment

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