0% found this document useful (0 votes)
34 views3 pages

Each Remove-Item C:/tobedeleted - Recurse

This document provides PowerShell commands to: 1. Find processes using the most memory and restart a DHCP service. 2. Remove all files in a directory without prompts and get information about the computer make, model, and BIOS. 3. List installed hotfixes, get the logged on username, and find installed application names. 4. Get IP addresses and detailed IP configuration and find network cards with DHCP enabled. 5. Enable DHCP on all network adapters, add and remove a printer, and get disk capacity, free space, and physical memory information.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views3 pages

Each Remove-Item C:/tobedeleted - Recurse

This document provides PowerShell commands to: 1. Find processes using the most memory and restart a DHCP service. 2. Remove all files in a directory without prompts and get information about the computer make, model, and BIOS. 3. List installed hotfixes, get the logged on username, and find installed application names. 4. Get IP addresses and detailed IP configuration and find network cards with DHCP enabled. 5. Enable DHCP on all network adapters, add and remove a printer, and get disk capacity, free space, and physical memory information.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

1.

Find the five processes using the most memory


ps | sort p ws | select last 5

2. Cycle a service (stop, and then restart it) like DHCP


Restart-Service DHCP

3. Remove all files within a directory without being prompted for


each Remove-Item C:\tobedeleted Recurse
4. Get information about the make and model of a computer
-- Get-WmiObject -Class Win32_ComputerSystem
5. Get information about the BIOS of the current computer
-- Get-WmiObject -Class Win32_BIOS ComputerName
NAME
6. List installed hotfixes (QFEs, or Windows Update files) -- GetWmiObject -Class Win32_QuickFixEngineering -ComputerName NAME

7. Get the username of the person currently logged on to a


computer --Get-WmiObject

-Class Win32_ComputerSystem -Property

UserName ComputerName NAME

8. Find just the names of installed applications on the current


computer --Get-WmiObject

-Class Win32_Product -ComputerName .

| Format-Wide -Column 1

9. Get IP addresses assigned to the current computer -- GetWmiObject -Class Win32_NetworkAdapterConfiguration -Filter
IPEnabled=TRUE -ComputerName . | Format-Table -Property
IPAddress

Get a more detailed IP configuration report for the current

10.

machine --Get-WmiObject

-Class

Win32_NetworkAdapterConfiguration -Filter IPEnabled=TRUE


-ComputerName . | Select-Object -Property [a-z]*
-ExcludeProperty IPX*,WINS*

To find network cards with DHCP enabled on the current

11.

computer --Get-WmiObject

-Class

Win32_NetworkAdapterConfiguration -Filter "DHCPEnabled=true"


-ComputerName

12.
Enable DHCP on all network adapters on the current
computer -- Get-WmiObject -Class
Win32_NetworkAdapterConfiguration -Filter
IPEnabled=true -ComputerName . | ForEachObject -Process {$_.EnableDHCP()}
Add a printer -- (New-Object

13.

-ComObject

WScript.Network).AddWindowsPrinterConnection("\\printerserver\h
plaser3")

Remove a printer -- (New-Object

14.

-ComObject

WScript.Network).RemovePrinterConnection("\\printerserver\hplas
er3 ")

15.

get disk capacity and free space

16.

get-WmiObject win32_logicaldisk

view Total Physical Memory


Get-WMIObject -class win32_physicalmemory | Format-Table devicelocator, capacity a

You might also like