reading variables in powershell script from text file
I want to write a Windows powershell script which will read the variable from a text file, sothat I can use it further process. for example, I have text file demo.txt and the contents of it is--
Now, I have demo.ps1 script and I want to read server and user names separately to perform the specific task for each server-
connect server Server -username user
but when I am trying it with Get-Content, it is reading the whole line,not a single variable.
foreach( $Server in Get-Content C:\Scripts\demo.txt)
connect server $Server -username $user
Please provide me your valuable suggestions.
Thanks in Advance...