Tip / Trick of the week

Use this PowerShell script to replace a string in all files in a directory. This can be helpful when moving applications from one server to another, or changing server names. The ” | Where-Object { $_.Name -like “*.” }” can be dropped if you aren’t looking for a particular file type. Be sure to match the output file encoding.

$files = (get-childitem -recurse | Where-Object { $_.Name -like “*.” }).fullname

ForEach ( $file in $files ) {

(get-content $file).replace(”,”) | out-file $file -encoding ASCII

}

Share:

Facebook
Twitter
LinkedIn

Contact Us

Name
=
On Key

More Posts

WME Cybersecurity Briefings No. 040
Cyber Security

WME Security Briefing 04 August 2025

1. NightEagle APT Exploits Zero-Day in Microsoft Exchange to Target Chinese Defense and Tech Sectors Overview A new advanced persistent threat group, dubbed NightEagle (also called APT-Q-95), is being linked to a string of attacks. These

Read More »
Be assured of everything

Get WME Services

Stay ahead of the competition with our Professional IT offerings.

=