Welcome everyone!
Today i’m going to share my top 10 (beginner-friendly) Powershell commands that i use quite frequently.
I hope that you will find these commands useful.
1. Connect to a remote computer:
Enter-PSSession -ComputerName "Computer1"
2. Get events from EventViewer:
Get-WinEvent -computername "Computer1" -FilterHashTable @{ LogName = "System"; StartTime = "2020-02-12"}
3. Get OS BuildNumber:
Get-WmiObject -Class Win32_OperatingSystem -ComputerName "Computer1" | Select BuildNumber
4. Get OS ReleaseID:
(Get-ItemProperty -Path ‘HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion’).ReleaseId
5. Get values from the registry:
Get-ChildItem -Path 'HKLM:\PATH\TO\KEY'
6. Set values in the registry:
New-ItemProperty -Path "Registry::\HKEY_CURRENT_USER\PATH\TO\KEY\" -Name 'Flags' -PropertyType DWORD -Value "1337"
7. Show the latest installed updates (KB’s):
(Get-Hotfix | sort installedon)
8. Get serialnumber (CimInstance):
(Get-CimInstance -ClassName Win32_BIOS).Serialnumber
9. Get Bios version (CimInstance):
(Get-CimInstance -ClassName Win32_BIOS).SMBIOSBIOSVersion
10. Get computer model (CimInstance):
(Get-WmiObject Win32_Computersystem).Model
Comment down below if you have any questions! 🙂