Basic PowerShell commands for windows machines

Поділитися
Вставка
  • Опубліковано 18 вер 2024
  • In this video I have used some basic PowerShell commands which can be used for checking the basic system information or it can be used for troubleshoot the system related issues. These PowerShell commands can be used for windows 11, windows 10 or windows servers as well.
    Below are the PowerShell commands.
    #Checking the Public IP Address fo your system
    $publicIpAddress = (Invoke-WebRequest -Uri "ifconfig.me/ip").Content.Trim()
    Write-Host "Public IP Address: $publicIpAddress"
    #Get Active Network Connections:
    Get-NetTCPConnection | Where-Object {$_.State -eq "Established"} | Select-Object LocalAddress, LocalPort, RemoteAddress, RemotePort
    #List Network Adapters:
    Get-NetIPAddress | Select-Object InterfaceAlias, IPAddress
    #List Running Processes:
    Get-Process
    #Find Large Files:
    Get-ChildItem -Path "C:\users\Administrator\Downloads" -File | Sort-Object Length -Descending | Select-Object -First 10 Name, Length
    #Check OS Name and CPU Architecture
    Get-ComputerInfo | Select-Object OSName, OSArchitecture
    #display the disk size in gigabytes (GB)
    Get-WmiObject Win32_LogicalDisk |
    Select-Object DeviceID, VolumeName, @{Name="FreeSpaceGB";Expression={"{0:N2}" -f ($_.FreeSpace / 1GB)}}, @{Name="SizeGB";Expression={"{0:N2}" -f ($_.Size / 1GB)}}
    #List Last 10 System events
    Get-EventLog -LogName system -Newest 10
    #List Scheduled Tasks:
    Get-ScheduledTask | Select-Object TaskName, State
    #All Hyper-V vms
    Get-VM | Where-Object {$_.State -eq "Running"} | Select-Object Name, State
    #Find Files by Extension:
    Get-ChildItem -Path "C:\users\Administrator\Downloads" -File -Filter *.txt
    #List Local User Accounts
    Get-LocalUser | Select-Object Name, Enabled

КОМЕНТАРІ •