Some very useful Powershell tricks.

Posted: January 30, 2018. At: 1:45 PM. This was 4 weeks 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.

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   :

No comments have been made. Use this form to start the conversation :)

Leave a Reply