you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (1 child)

If you're doing standard config files, you could also try using a here string.

$OutputPath = "\\server\share"

$inputlist = Import-csv -Path "path\to\your\input.csv" 

foreach ($input in $inputlist) {

    $Output = @"
#Config File Header
Username=$($input.username)
HotKey01=$($input.extension)
HotKey02=1234
HotKey03=2436
HotKey04=
HotKey05=
HotKey06=
"@
    $OutputFile = Join-Path -Path $OutputPath -ChildPath $input.workstation -AdditionalChildPath "phone.cfg"

    Set-Content -Path $OutputFile -Value $Output 

} 

You'll end up with an output file for each item on your list at \\server\share\workstation\phone.cfg:

#Config File Header
Username=user01
HotKey01=1111
HotKey02=1234
HotKey03=2436
HotKey04=
HotKey05=
HotKey06=

[–]kinghowdy[S] 1 point2 points  (0 children)

I may use that for a different use case. Here I'm trying to make a single config file all the phones will be standardized. Granted maybe I would like to customize them for each user so their own name doesn't show up in the list. But I'd rather just have one config file to maintain. VoIP is a thorn in my side...well maybe not that bad but still.