Skip to main content

Posts

Showing posts from October, 2018

Useful Windows Powershell Script

Some of the useful powershell script which can be used in our day to day life. 1. Get running scheduled tasks on a Windows system. (get-scheduledtask).where({$_.state -eq 'running'}) 2. Get system uptime from multiple computers Get-CimInstance Win32_operatingsystem -ComputerName $computers | Select-Object PSComputername,LastBootUpTime, @{Name="Uptime";Expression = {(Get-Date) - $_.LastBootUptime}} 3. Get drive utilization using PSDrives Get-PSDrive -PSProvider filesystem | where-object {$_.used -gt 0} | select-Object -property Root,@{name="SizeGB";expression={($_.used+$_.free)/1GB -as [int]}}, @{name="UsedGB";expression={($_.used/1GB) -as [int]}}, @{name="FreeGB";expression={($_.free/1GB) -as [int]}}, @{name="PctFree";expression={[math]::round(($_.free/($_.used+$_.free))*100,2)}} 4. List of Installed applications Get-PSDrive -PSProvider filesystem | where-object {$_.used -gt 0} | select-Object -property Root,@{name="SizeGB&