Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #This script is used to setup .ini file for a workstation
- #
- #Variables to configure
- $stnnumbers=import-csv "\\DFS\public documents\software\ABC\ABC-STATIONNUMBERS.csv"
- foreach ($comp in $stnnumbers)
- {
- $computer = $comp.computer
- $stationnumber = $comp.stationnumber
- #
- #Variables that don't need touching
- $inistart=get-content "\\DFS\public documents\software\ABC\ABC.ini"
- $newinipath="\\$computer\C$\ABC7\ABC.ini"
- [regex]$regex="Station Number="
- $STNfinal = "Station Number=" + $StationNumber
- #
- $inistart | set-content $newinipath
- $newini = get-content $newinipath
- $newini2 = $newini | ForEach-Object {$_ -replace $regex , $STNfinal}
- $newini2 | set-content $newinipath
- $finalini = get-content $newinipath
- get-content $newinipath
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement