IT Knowledge Base

User Tools

Site Tools


Contact me at for any feedback or suggestions.

My other sites:

Search all my sites:



See also: Scripts

Remote PowerShell

enter-pssession computername

PowerShell and Group Policy

“Group Policy scripts will always run, regardless of your local script execution policy. Even if your execution policy is restricted Group Policy scripts will still run using a Bypass policy” - 4sysops

Text Manipulation

Find and Replace in a CSV File

[io.file]::readalltext(“C:\fso\usersconsolidated.csv”).replace(“Atlanta”,”Cobb”) | Out-File c:\fso\replacedAtlanta.csv -Encoding ascii –Force

Search for and Replace Words in a CSV File by Using PowerShell – Hey, Scripting Guy! Blog

Working with Processes

Kill a process by owner:

$owners = @{}
gwmi win32_process |% {$owners[$_.handle] = $_.getowner().user}
$processes = get-process | select processname,Id,@{l="Owner";e={$owners[$]}}
$process_to_kill = $processes | where ProcessName -eq WRSA | where Owner -eq SYSTEM
$process_to_kill | Stop-Process

Logical AND

| Where {$ -eq statement -and $_.anotherproperty -eq anotherstatement}
powershell.txt · Last modified: 2018/04/09 09:56 (external edit)