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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
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 } |
1 2 3 4 |
} } } }<span style="color: black; font-family: Courier New; font-size: 8pt;"> </span> |
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
vytjak
December 31, 2013 at 3:32 pm (UTC 0) Link to this comment
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 🙂
waldo
January 2, 2014 at 8:04 am (UTC 0) Link to this comment
That is indeed a nicer way to replace the loop :-).
Thanks for sharing!
Microsoft Dynamics NAV
May 15, 2014 at 5:09 am (UTC 0) Link to this comment
I think this snippet is really works…..thanks for posting
NAV 2013 R2: Powershell function to check if ServerInstance is Multitenant or not - Waldo's Blog - Microsoft Dynamics NAV
December 31, 2013 at 12:35 am (UTC 0) Link to this comment
[…] Continue reading » […]
NAV 2013 R2: Powershell function to check if ServerInstance is Multitenant or not | Pardaan.com
January 10, 2014 at 6:33 am (UTC 0) Link to this comment
[…] Bron : Waldo’s Blog Lees meer… […]
Get a specific Dynamics NAV Server Setting with PowerShell (a better Get-NAVServerConfiguration) » waldo's blog
February 10, 2015 at 12:01 am (UTC 0) Link to this comment
[…] 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 […]
Get a specific Dynamics NAV Server Setting with PowerShell (a better Get-NAVServerConfiguration) - Microsoft Dynamics NAV Community
February 10, 2015 at 12:04 am (UTC 0) Link to this comment
[…] 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 […]