Good day, I have the following script below which i am using to get a specific value from a remote pc within the company network.
I am stuck on where I would add the export-csv function so that i can export all the data into a csv file.
any help would be appreciated.
$computers = Get-Content "c:\temp\Servers.txt"
$key = 'SOFTWARE\Fortinet\FortiClient\Sslvpn\Tunnels\RCL SSL VPN'
$valuename = 'Server'
$computers = Get-Content Servers.txt
foreach ($computer in $computers) {
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $computer)
$MachineName = $computer
$regkey = $reg.opensubkey($key)
Write-host $MachineName "," $regkey.getvalue($valuename) `r`n
}