Hi, to end the year with – here is a small tip.
I’m working on improving the Backup/Restore procedure from this blogpost .. . While doing that, I was looking for a way to see whether my current instance was actually a Multitenant-server or not. In a way, I had to be able to read this configuration in powershell:
And I found a way .. by looping the output of the Get-NAVServerConfiguration commandlet. Here is the function:
function Get-NAVIsMultiTenantServerInstance { [CmdletBinding()] param ( [parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] [String]$ServerInstance ) PROCESS { $CurrentServerConfig = Get-NAVServerConfiguration -ServerInstance $ServerInstance foreach ($CurrentServerConfigKey in $CurrentServerConfig) { if ($CurrentServerConfigKey.key -eq "Multitenant") { if ($CurrentServerConfigKey.Value -eq "false") { return $false } else { return $true }
}
}
}
}
Don’t know if you like the function-name – but look at the function.. . May be there are smarter, better, more performant, more stable ways to do it .. if so .. please share :-).
In the mean time, this is how I can use the function (for example in my Backup-function):
Enjoy!
3 comments
4 pings
Hi Waldo, here’s a snippet to replace the loop to get the required value:
(Get-NAVServerConfiguration -ServerInstance $serverInstance -AsXML).SelectSingleNode(‘configuration/appSettings/add[@key=”Multitenant”]’).value
Enjoy the NY festivities 🙂
Author
That is indeed a nicer way to replace the loop :-).
Thanks for sharing!
I think this snippet is really works…..thanks for posting
[…] Continue reading » […]
[…] Bron : Waldo’s Blog Lees meer… […]
[…] might remember this blogpost: NAV 2013 R2: Powershell function to check if ServerInstance is Multitenant or not. It was a small tip on how to check a certain […]
[…] might remember this blogpost: NAV 2013 R2: Powershell function to check if ServerInstance is Multitenant or not. It was a small tip on how to check a certain […]