functions/get-d365instancename.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

<#
    .SYNOPSIS
        Gets the instance name
         
    .DESCRIPTION
        Get the instance name that is registered in the environment
         
    .EXAMPLE
        PS C:\> Get-D365InstanceName
         
        This will get the service name that the environment has configured
         
    .NOTES
        Tags: Instance, Servicing
         
        Author: Rasmus Andersen (@ITRasmus)
         
        The cmdlet wraps the call against a dll file that is shipped with Dynamics 365 for Finance & Operations.
        The call to the dll file gets HostedServiceName that is registered in the environment.
         
#>

function Get-D365InstanceName {
    [CmdletBinding()]
    param ()

    [PSCustomObject]@{
        InstanceName = "$($(Get-D365EnvironmentSettings).Infrastructure.HostedServiceName)"
    }
}