<# @Title = RaVentory Portal Migraion script @Author = Jan-Niklas Saegert @Version = 0.1 @Description = This script is supposed to adjust the Connections.xml of RayVentory Portal 11.0, so that it works for 11.1 as well #> #Extraction of RVP appdata storage from Registry $appdataPath = Get-ItemProperty -Path “HKLM:\SOFTWARE\WOW6432Node\Raynet\RayVentoryPortal” -Name "AppDataPath" | Select-Object -ExpandProperty "AppDataPath" try { $appdataPathFull = $appDataPath + "\Raynet\RayVentoryPortal\Config\Connections.xml" $appdataPathFullOracle = $appDataPath + "\Raynet\RayVentoryPortal\Config\OracleConnections.xml" $appdataPathFullvSphere = $appDataPath + "\Raynet\RayVentoryPortal\Config\vSphereConnections.xml" $appdataPathFullSnmp = $appDataPath + "\Raynet\RayVentoryPortal\Config\SnmpConnections.xml" if(Test-Path $appdataPathFull) { $connectionFile = Get-Content $appdataPathFull -ErrorAction Stop #Removement of old Connections.xml Remove-Item $appdataPathFull #Literally adjustment of every line in the file for($i=0; $i -ilt $connectionFile.Length ; $i++) { #Creation of a Uuid for every Network device $Uuid = [guid]::NewGuid() #Creation of a temprorary variable for the file line $tmpLine = $connectionFile[$i] #Replacement of several string with the new created Uuid if($tmpLine -cmatch '') { $tmpLine = $tmpLine.Replace('', '') #| Out-File $appdataPathFull -Append } if($tmpLine -cmatch '') { $tmpLine = $tmpLine.Replace('', '') #| Out-File $appdataPathFull -Append } #Output of new line in new created Connections.xml $tmpLine | Out-File $appdataPathFull -Append Write-Progress -Activity "Progress of editing Connections.xml" -Status "$i% Complete:" -PercentComplete ($i/$connectionFile.Length * 100); } } else { Write-Host "Connections.xml wasn't found or doesn't exist"| Out-File "C:\migrationLog.txt" -Append } Write-Host "Migration process was performed successfully!" } catch { write-host "Migration failed. Check the log file at C:\migrationLog.txt" $_| Out-File "C:\migrationLog.txt" -Append }