You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Miles Cummings edited this page Dec 15, 2023
·
1 revision
taskScript.ps1
# Storyline: Grab the network adapter information using the WMI class,
# get the IP address, default gateway, DNS servers, and DHCP server,
# and open/close the calculator app.
# Output of 'Get-WmiObject' piped to 'Select-Object', followed by object
# parameters to display.
Get-WmiObject -Class Win32_NetworkAdapterConfiguration | `
Select-Object IPAddress, DHCPServer, DefaultIPGateway, DNSServerSearchOrder
# Export running processes to a CSV file
Get-Process | Select-Object ProcessName, Path, ID | `
Export-Csv -Path "C:\Users\Miles\Desktop\Processes.csv" -NoTypeInformation
# Export running services to a CSV file
Get-Service | Where { $_.Status -eq "Running" } | `
Export-Csv -Path "C:\Users\Miles\Desktop\Services.csv" -NoTypeInformation
# Start the calculator app
Start-Process -FilePath "calc.exe"
# Wait 5 seconds so the calculator app has time to load up before being closed
Start-Sleep -Seconds 5
# Stop the calculator app
Get-Process -Name "CalculatorApp" | Stop-Process -Force