12-05-2018 02:02 AM - edited 12-05-2018 02:14 AM
Hi.
IHAC that was over 2000 services (WMS, WFS, WMPS, etc...) in 2013 version.
We're starting to migrate the solution to 2018 version and I need to upgrade those services.
Anyone know if there is a way to do it without going to the Administration Console and manually click in the upgrade version button?
Some kind of a command line that we can use to create a batch for all services to be upgraded...
The Data Sources associated to those services should also be upgraded.
Best regards,
António
Solved! Go to Solution.
12-05-2018 04:18 AM
Hi Antonio,
I don't think that this is possible because the upgrade button calls internal methods on the Administration Console Service and its interface isn't documented.
I would be very careful by doing this upgrade since it's an upgrade over 3 major versions. The web.config files may have changed fundamentally on some services and just the usage of the Upgrade button might not lead to good results. Customer should anyway test each single service after doing the upgrade. Original files are being backed up in case there appears an error.
Standard web services such as WMS, WFS, WMTS will be probably easy to do, but I'd be very cautious with Portals. Note that Portals need specific upgrade approach, incl. backing up the maps ans workspaces.
Regards,
Jan
12-05-2018 04:32 AM
Thanks Jan.
I'm not worried with upgrading Portals because those I'll do manually. We've some customizations that needs to be migrated, so that issue doesn't bother me.
My problem is the services. There are, like I said, over 2000 and doing it manually isn't feasible. We would spend to many days doing that.
Best regards,
12-05-2018 05:48 AM
I found, that it's possible to do using PowerShell and web request calls to AdminConsole (verified by Fiddler)
You can use following sample script to call an upgrade of selected instance name:
$username = "Administrator" $password = "Qwert123" | ConvertTo-SecureString -asPlainText -Force $cred = New-Object System.Management.Automation.PSCredential($username,$password) $res = Invoke-WebRequest http://win2016/AdminConsole/App/Services/UpgradeService?serviceName=WMS -Credential $cred -MaximumRedirection 0
Only thing needed is a list of instance names and then you can run the script above in a loop. I found a nice sample for searching through registry: https://gallery.technet.microsoft.com/scriptcenter/Search-Registry-Find-Keys-b4ce08b4
After registering this function in PS, you simply call:
Search-Registry -Path "HKLM:\SOFTWARE\WOW6432Node\Intergraph\Geospatial Server\Instances" -Recurse -ValueDataRegex "WMS|WFS|WMTS"
Sample output:
Key Reason --- ------ HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Intergraph\Geospatial Server\Instances\WFS ValueData HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Intergraph\Geospatial Server\Instances\WFSPOINTS ValueData HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Intergraph\Geospatial Server\Instances\WMS ValueData HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Intergraph\Geospatial Server\Instances\WMS-SEC ValueData HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Intergraph\Geospatial Server\Instances\WMS-US ValueData HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Intergraph\Geospatial Server\Instances\WMSFacade ValueData
After some playing-around, you should be able to put things together.
12-05-2018 06:24 AM - edited 12-06-2018 04:54 AM
Resulting script would be something like this (requires some fine tuning)
function UpgradeInstances{ $username = "Administrator" $password = "Qwerty123" | ConvertTo-SecureString -asPlainText -Force $cred = New-Object System.Management.Automation.PSCredential($username,$password) $Path = "HKLM:\SOFTWARE\WOW6432Node\Intergraph\Geospatial Server\Instances" # put your search pattern here: $ValueDataRegex = "WMS|WFS|WMTS" foreach ($CurrentPath in $Path) { Get-ChildItem $CurrentPath | ForEach-Object { $Key = $_ if ($ValueDataRegex) { Write-Verbose ("{0}: Checking ValueDataRegex" -f $Key.Name) if (($Key.GetValueNames() | % { $Key.GetValue($_) }) -match $ValueDataRegex) { Write-Verbose " -> Match!" $InstanceName = ($Key.Name).Substring(($Key.Name).LastIndexOf("\")+1,($Key.Name).Length-($Key.Name).LastIndexOf("\")-1) $request = $null Try { $request = Invoke-WebRequest "http://win2016/AdminConsole/App/Services/UpgradeService?serviceName=$InstanceName" -Credential $cred -MaximumRedirection 0 -ErrorAction SilentlyContinue } # Catching 302 redirects done by the UpgradeInstance request catch [System.Net.WebException] { $request = $_.Exception.Response } catch { Write-Error $_.Exception return $null } return [PSCustomObject] @{ Upgraded = $InstanceName Status = $request.StatusCode } } } } } }
12-05-2018 06:41 AM
Jan,
Thanks for all the help.
I'll do some tests and let you know if it worked.
Best regards,
António
12-05-2018 09:06 AM
Jan,
Once again thanks for your inputs.
Based on your idea I created a C# command to execute the upgrade of the services.
It seems to worked. I've to finish it to put some validations and other stuff but in the tests that I did it upgraded from 16.05.0000 to 16.05.0100.
Best regards,
António