Generates a .doc of commands to paste into devices. pulls IP and hostname from csv and structures the commands in a way you can copy/pasta.
CSV should look like this:
192.168.1.1,switch1
192.168.1.2,switch2
192.168.1.3,switch3
$pshost = get-host $pswindow = $pshost.ui.rawui $pswindow.WindowTitle = "Generate Commands" New-Item "C:\CyberTransport\04-Scripts\Powershell-Generate-Command-Sheet-From-CSV\generated.doc" -Force -Type file #Variables $excelFile = "C:\CyberTransport\04-Scripts\Powershell-Generate-Command-Sheet-From-CSV\nodes.csv" $generatedFile = "C:\CyberTransport\04-Scripts\Powershell-Generate-Command-Sheet-From-CSV\generated.doc" get-content $excelFile | Where {-not ($_.StartsWith('#'))} | foreach { $ipAddress = $_.split("{,}")[0] $hostname = $_.split("{,}")[1] $commands = @" !--- SSH into $ipAddress`r`n conf t`r`n hostname $hostname`r`n end`r`n wr`r`n exit`r`n `r`n "@ $commands | Out-File $generatedFile -Append -Encoding ascii } ii $generatedFile