Skip to main content

Posts

Showing posts from January, 2018

25 powershell command

1. Navigate the Windows Registry like the file system: cd hkcu: 2. Search recursively for a certain string within files: dir –r | select string "searchforthis" 3. Find the five processes using the most memory: ps | sort –p ws | select –last 5 4. Cycle a service (stop, and then restart it) like DHCP: Restart-Service DHCP 5. List all items within a folder: Get-ChildItem – Force 6. Recurse over a series of directories or folders: Get-ChildItem –Force c:\directory –Recurse 7. Remove all files within a directory without being prompted for each: Remove-Item C:\tobedeleted –Recurse 8. Restart the current computer: (Get-WmiObject -Class Win32_OperatingSystem -ComputerName .).Win32Shutdown(2) Collecting information 9. Get information about the make and model of a computer: Get-WmiObject -Class Win32_ComputerSystem 10. Get information about the BIOS of the current computer: Get-WmiObject -Class Win32_BIOS -ComputerName . 11. List ins...