Advertisement
Guest User

Ini file script UPDATED

a guest
Oct 7th, 2015
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #This script is used to setup .ini file for a workstation
  2. #
  3. #Variables to configure
  4. $stnnumbers=import-csv "\\DFS\public documents\software\ABC\ABC-STATIONNUMBERS.csv"
  5. foreach ($comp in $stnnumbers)
  6. {
  7. $computer = $comp.computer
  8. $stationnumber = $comp.stationnumber
  9. #
  10. #Variables that don't need touching
  11. $inistart=get-content "\\DFS\public documents\software\ABC\ABC.ini"
  12. $newinipath="\\$computer\C$\ABC7\ABC.ini"
  13. [regex]$regex="Station Number="
  14. $STNfinal = "Station Number=" + $StationNumber
  15. #
  16. $inistart | set-content $newinipath
  17. $newini = get-content $newinipath
  18. $newini2 = $newini | ForEach-Object {$_ -replace $regex , $STNfinal}
  19. $newini2 | set-content $newinipath
  20. $finalini = get-content $newinipath
  21. get-content $newinipath
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement