# encoding: ascii
# api: powershell
# title: Convert File Encoding
# description: R.Vantrease ver 1.0 – The source control I use does not understand the default encoding that PowerShell_ISE saves scripts in (Unicode Big Endian), so I wanted a way to quickly convert my scripts to a friendlier encoding.  I wrote the following little ditty to convert all the PowerShell scripts and module files to ASCII encoding.
# version: 0.1
# author: Richard Vantreas
# license: CC0
# x-poshcode-id: 2999
# x-archived: 2016-08-03T11:04:02
# x-published: 2012-10-12T15:14:00
#
#
cd c:\windows\temp\common

foreach($File in get-childitem | where-object{($_.Extension -ieq '.PS1') -or ($_.Extension -ieq '.PSM1')})
{
    $FileName = $File.Name
    $TempFile = "$($File.Name).ASCII"

    get-content $FileName | out-file $TempFile -Encoding ASCII 

    remove-item $FileName

    rename-item $TempFile $FileName
}
