Good morning,
I have the following script and it works just fine, but instead of hard coding 100 servers I want it to read the servers from a .txt file. Here is my code any help would be great:
[string[]]$servers = 'Server1,Server2,Server3' -split ','
$credential = Get-Credential
Invoke-Command -ComputerName $servers -Credential $credential -ScriptBlock {
Get-ItemProperty 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*' | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate
} | Format-Table PSComputerName, DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize | Out-File C:\Temp\SoftwareListByServer.txt