From 3368a8651d2dbd07d8c58f472e6c8bc89da7a1fc Mon Sep 17 00:00:00 2001 From: capntack Date: Sun, 30 Jul 2023 13:57:40 -0500 Subject: [PATCH] Separated into Computers/Users/Groups --- ps-commands.md | 46 +++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 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,64 +24,72 @@ Get-WmiObject win32_product -ComputerName $ComputerName | Where-Object {$_.$Colu
-### Fetch AD Groups with $SearchTerm in them +### Remotely Fetch $ComputerName's Boot Time ```powershell -Get-ADGroup -Filter 'name -like "*$SearchTerm*"' | Sort-Object | select Name +Get-CimInstance -ClassName Win32_OperatingSystem -ComputerName $ComputerName | slect csname, lastbootuptime ```
-### Remotely Fetch $ComputerName's Boot Time +### Fetch $ComputerName's Group Membership ```powershell -Get-CimInstance -ClassName Win32_OperatingSystem -ComputerName $ComputerName | slect csname, lastbootuptime +Get-ADPrincipalGroupMembership (Get-ADComputer $ComputerName) | select-object name ```
-### Fetch $ComputerName's Group Membership +### Remotely Fetch $ComputerName's Make & Model ```powershell -Get-ADPrincipalGroupMembership (Get-ADComputer $ComputerName) | select-object name +Get-CimInstance -ComputerName $ComputerName -ClassName Win32_ComputerSystem | Select-Object -Property Manufacturer, Model ```
-### Fetch $Username's Group Membership +### Remotely Fetch $ComputerName's Serial Number ```powershell -Get-ADPrincipalGroupMembership (Get-ADUser $Username) | select-object name +Get-CimInstance -ComputerName $ComputerName -ClassName Win32_bios | Select-Object -Property SerialNumber ```
-### Fetch $ComputerName's Make & Model +### Remotely Fetch $ComputerName's Total/Free Storage ```powershell -Get-CimInstance -ComputerName $ComputerName -ClassName Win32_ComputerSystem | Select-Object -Property Manufacturer, Model +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)}} ```
-### Fetch $ComputerName's Serial Number +### Remotely Fetch $ComputerName's BIOS Version ```powershell -Get-CimInstance -ComputerName $ComputerName -ClassName Win32_bios | Select-Object -Property SerialNumber +Get-WmiObject -Class Win32_BIOS -ComputerName $ComputerName ``` +## Users +
-### Remotely Fetch $ComputerName's Total/Free Storage +### Fetch $Username's Group Membership ```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)}} +Get-ADPrincipalGroupMembership (Get-ADUser $Username) | select-object name ```
-### Remotely Fetch $ComputerName's BIOS Version +## Groups + +
+ +### Fetch AD Groups with $SearchTerm in them ```powershell -Get-WmiObject -Class Win32_BIOS -ComputerName $ComputerName -``` \ No newline at end of file +Get-ADGroup -Filter 'name -like "*$SearchTerm*"' | Sort-Object | select Name +``` + +
\ No newline at end of file