<# .PARAMETER reg_path Registry-Key for Riverbird .PARAMETER reg_keys List of Keys .PARAMETER lc_path Path to the LauncherConfig .PARAMETER lc_file FileName to extract information .PARAMETER log_File Output logged to that filename .PARAMETER Line_Break Breaks long lines in output .EXAMPLE --- Registry: HKLM:\SOFTWARE\WOW6432Node\Riverbird --- DeviceGuid => 03e6a306-ed57-4c5a-9da4-ef30720a4719 LC_MonitoringVersion => 11.0.2301 LC_WebServiceUrl1 => https://c-suite.c-entron.de/RiverbirdServiceProductive LC_PermanentToken => yYwDpwtWIP1PxWc8860mZnIsC4GzvdMI00M0arp7VRShJVRwA7x7C1DDNPvcqKfN --- LauncherConfig.xml: C:\Program Files (x86)\Riverbird\Agent Launcher\LauncherConfig.xml --- MonitoringVersion => 11.0.2301 WebServiceURL1 => https://c-suite.c-entron.de/RiverbirdServiceProductive PermanentToken => yYwDpwtWIP1PxWc8860mZnIsC4GzvdMI00M0arp7VRShJVRwA7x7C1DDNPvcqKfN .LINK #> # Path and Subkey in Registry $reg_path = "HKLM:\SOFTWARE\WOW6432Node\Riverbird" $reg_keys = @("DeviceGuid","LC_MonitoringVersion","LC_WebServiceUrl1","LC_PermanentToken") # LauncherConfig.xml $lc_path = "C:\Program Files (x86)\Riverbird\Agent Launcher" $lc_file = "LauncherConfig.xml" $lc_keys = @("MonitoringVersion","WebServiceURL1","PermanentToken") # Log all information into that file $log_File = "C:\Temp\Get-LauncherInfo" # Function to generate Message in Log function log_Output { Param ( $output ) # Current date $date = (Get-Date -format "yyyy-MM-dd_HH-mm-ss") $ldate = (Get-Date -format "yyyy-MM-dd_HH-mm") # Skript Log $log_File = "{0}-{1}.log" -f $log_File, $ldate # Format a log message $message = "{0}: {1}" -f $date, $($output) $message = $message | Out-File $log_File -Append } # Build a message string $message = "--- Registry: {0} ---" -f $reg_path # Log message to Stdout Write-Output $message # Log message to a protocol log_Output $message # Iterate through list foreach ($rk in $reg_keys) { # Values for Keys $result = (Get-ItemProperty $reg_path -Name $rk).$rk # Log blank line to Stdout Write-Output " " # Log blank line to a protocol log_Output " " # Build a message string $message = " {0} => {1}" -f $rk, $result # Log message to Stdout Write-Output $message # Log message to a protocol log_Output $message } # Log blank line to Stdout Write-Output " " # Log blank line to a protocol log_Output " " # Build a message string $message = "--- LauncherConfig.xml: {0}\{1} ---" -f $lc_path, $lc_file # Log message to Stdout Write-Output $message # Log message to a protocol log_Output $message # Change directory cd $lc_path # Iterate through list foreach ($lck in $lc_keys) { # Values for Keys $result = (Get-Content -path $lc_path\$lc_file | Select-String $lck) $result = $result.ToString().Split('<')[1].Trim() $result = $result.ToString().Split('>')[1].Trim() # Log blank line to Stdout Write-Output " " # Log blank line to a protocol log_Output " " # Build a message string $message = " {0} => {1}" -f $lck, $result # Log message to Stdout Write-Output $message # Log message to a protocol log_Output $message } exit 0