From ad2d7d35a5fae3c71716b6e0051f85461337defb Mon Sep 17 00:00:00 2001 From: capntack Date: Sun, 30 Jul 2023 13:54:26 -0500 Subject: [PATCH 1/2] Added two new commands --- ps-commands.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ps-commands.md b/ps-commands.md index 612e1e7..01b052f 100644 --- a/ps-commands.md +++ b/ps-commands.md @@ -64,4 +64,20 @@ Get-CimInstance -ComputerName $ComputerName -ClassName Win32_ComputerSystem | Se ```powershell Get-CimInstance -ComputerName $ComputerName -ClassName Win32_bios | Select-Object -Property SerialNumber +``` + +
+ +### Remotely Fetch $ComputerName's Total/Free Storage + +```powershell +Get-WmiObject Win32_LogicalDisk -ComputerName $ComputerName -Filter DriveType=3 | Select-Object DeviceID, @{'Name'='Size (GB)'; 'Expression'={[math]::truncate($_.size / 1GB)}}, @{'Name'='Freespace (GB)'; 'Expression'={[math]::truncate($_.freespace / 1GB)}} +``` + +
+ +### Remotely Fetch $ComputerName's BIOS Version + +```powershell +Get-WmiObject -Class Win32_BIOS -ComputerName $ComputerName ``` \ No newline at end of file From 3368a8651d2dbd07d8c58f472e6c8bc89da7a1fc Mon Sep 17 00:00:00 2001 From: capntack Date: Sun, 30 Jul 2023 13:57:40 -0500 Subject: [PATCH 2/2] Separated into Computers/Users/Groups --- ps-commands.md | 50 +++++++++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/ps-commands.md b/ps-commands.md index 01b052f..cbfd1c6 100644 --- a/ps-commands.md +++ b/ps-commands.md @@ -4,6 +4,10 @@ Note: unless otherwise stated, replace any variable such as `$ComputerName` with
+## Computers + +
+ ### Remotely Fetch a (Partial) Installed Program List for $ComputerName ```powershell @@ -20,14 +24,6 @@ Get-WmiObject win32_product -ComputerName $ComputerName | Where-Object {$_.$Colu
-### Fetch AD Groups with $SearchTerm in them - -```powershell -Get-ADGroup -Filter 'name -like "*$SearchTerm*"' | Sort-Object | select Name -``` - -
- ### Remotely Fetch $ComputerName's Boot Time ```powershell @@ -44,15 +40,7 @@ Get-ADPrincipalGroupMembership (Get-ADComputer $ComputerName) | select-object na
-### Fetch $Username's Group Membership - -```powershell -Get-ADPrincipalGroupMembership (Get-ADUser $Username) | select-object name -``` - -
- -### Fetch $ComputerName's Make & Model +### Remotely Fetch $ComputerName's Make & Model ```powershell Get-CimInstance -ComputerName $ComputerName -ClassName Win32_ComputerSystem | Select-Object -Property Manufacturer, Model @@ -60,7 +48,7 @@ Get-CimInstance -ComputerName $ComputerName -ClassName Win32_ComputerSystem | Se
-### Fetch $ComputerName's Serial Number +### Remotely Fetch $ComputerName's Serial Number ```powershell Get-CimInstance -ComputerName $ComputerName -ClassName Win32_bios | Select-Object -Property SerialNumber @@ -80,4 +68,28 @@ Get-WmiObject Win32_LogicalDisk -ComputerName $ComputerName -Filter DriveType=3 ```powershell Get-WmiObject -Class Win32_BIOS -ComputerName $ComputerName -``` \ No newline at end of file +``` + +## Users + +
+ +### Fetch $Username's Group Membership + +```powershell +Get-ADPrincipalGroupMembership (Get-ADUser $Username) | select-object name +``` + +
+ +## Groups + +
+ +### Fetch AD Groups with $SearchTerm in them + +```powershell +Get-ADGroup -Filter 'name -like "*$SearchTerm*"' | Sort-Object | select Name +``` + +
\ No newline at end of file