From fde1edf23a0a2b8afb6f5ac1b085ed9f41ba7752 Mon Sep 17 00:00:00 2001 From: pavankadabala-png Date: Fri, 10 Jul 2026 00:58:22 -0400 Subject: [PATCH 01/10] Use ConvertTo-PSFHashtable for splatting in Get-D365Environment (#870) --- d365fo.tools/functions/get-d365environment.ps1 | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/d365fo.tools/functions/get-d365environment.ps1 b/d365fo.tools/functions/get-d365environment.ps1 index 15f94147..10b8277e 100644 --- a/d365fo.tools/functions/get-d365environment.ps1 +++ b/d365fo.tools/functions/get-d365environment.ps1 @@ -123,10 +123,7 @@ function Get-D365Environment { return } - $Params = Get-DeepClone $PSBoundParameters - if($Params.ContainsKey("ComputerName")){$null = $Params.Remove("ComputerName")} - if($Params.ContainsKey("OutputServiceDetailsOnly")){$null = $Params.Remove("OutputServiceDetailsOnly")} - if($Params.ContainsKey("OnlyStartTypeAutomatic")){$null = $Params.Remove("OnlyStartTypeAutomatic")} + $Params = $PSBoundParameters | ConvertTo-PSFHashtable -ReferenceCommand Get-ServiceList $Services = Get-ServiceList @Params @@ -145,4 +142,4 @@ function Get-D365Environment { } $Results | Select-PSFObject -TypeName $outputTypeName Server, DisplayName, Status, StartType, Name -} \ No newline at end of file +} From 84cb8f0b30ab388a5e140b944eaa7c19e18feebb Mon Sep 17 00:00:00 2001 From: pavankadabala-png Date: Mon, 13 Jul 2026 09:57:21 -0400 Subject: [PATCH 02/10] refactor: use ConvertTo-PSFHashtable for splatting in Start-D365Environment (#870) --- d365fo.tools/functions/start-d365environment.ps1 | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/d365fo.tools/functions/start-d365environment.ps1 b/d365fo.tools/functions/start-d365environment.ps1 index 63e39cc1..4fdeac3d 100644 --- a/d365fo.tools/functions/start-d365environment.ps1 +++ b/d365fo.tools/functions/start-d365environment.ps1 @@ -122,10 +122,7 @@ function Start-D365Environment { $warningActionValue = "SilentlyContinue" if ($ShowOriginalProgress) { $warningActionValue = "Continue" } - $Params = Get-DeepClone $PSBoundParameters - if ($Params.ContainsKey("ComputerName")) { $null = $Params.Remove("ComputerName") } - if ($Params.ContainsKey("ShowOriginalProgress")) { $null = $Params.Remove("ShowOriginalProgress") } - if ($Params.ContainsKey("OnlyStartTypeAutomatic")) { $null = $Params.Remove("OnlyStartTypeAutomatic") } + $Params = $PSBoundParameters | ConvertTo-PSFHashtable -ReferenceCommand Get-ServiceList $Services = Get-ServiceList @Params @@ -158,4 +155,4 @@ function Start-D365Environment { Write-PSFMessage -Level Verbose "Results are: $Results" -Target ($Results.Name -join ",") $Results | Select-PSFObject -TypeName "D365FO.TOOLS.Environment.Service" Server, DisplayName, Status, StartType, Name -} \ No newline at end of file +} From 00a21ff241b6ccaaeedfd2183a2159cc9ad678dd Mon Sep 17 00:00:00 2001 From: pavankadabala-png Date: Mon, 13 Jul 2026 10:02:22 -0400 Subject: [PATCH 03/10] refactor: use ConvertTo-PSFHashtable for splatting in Start-D365EnvironmentV2 (#870) --- .../functions/start-d365environmentv2.ps1 | 142 +++++++++++++++++- 1 file changed, 138 insertions(+), 4 deletions(-) diff --git a/d365fo.tools/functions/start-d365environmentv2.ps1 b/d365fo.tools/functions/start-d365environmentv2.ps1 index 7933a17f..9a4538bd 100644 --- a/d365fo.tools/functions/start-d365environmentv2.ps1 +++ b/d365fo.tools/functions/start-d365environmentv2.ps1 @@ -126,9 +126,143 @@ function Start-D365EnvironmentV2 { $warningActionValue = "SilentlyContinue" if ($ShowOriginalProgress) { $warningActionValue = "Continue" } - $Params = Get-DeepClone $PSBoundParameters - if ($Params.ContainsKey("ShowOriginalProgress")) { $null = $Params.Remove("ShowOriginalProgress") } - if ($Params.ContainsKey("OnlyStartTypeAutomatic")) { $null = $Params.Remove("OnlyStartTypeAutomatic") } + $Params = $PSBoundParameters | ConvertTo-PSFHashtable -ReferenceCommand Get-ServiceList + + $psItemExceptionsFromStartServices = New-Object -TypeName "System.Collections.ArrayList" + $didServiceStartThrowException = $false + + $Services = Get-ServiceList @Params + + Write-PSFMessage -Level Verbose -Message "Working against: $ComputerName - starting services" + $temp = Get-Service -ComputerName $ComputerName -Name $Services -ErrorAction SilentlyContinue +<# + .SYNOPSIS + Cmdlet to start the different services in a Dynamics 365 Finance & Operations environment + + .DESCRIPTION + Can start all relevant services that is running in a D365FO environment + + .PARAMETER All + Set when you want to start all relevant services + + Includes: + Aos + Batch + Financial Reporter + Data Management Framework + + .PARAMETER Aos + Start the Aos (iis) service + + .PARAMETER Batch + Start the batch service + + .PARAMETER FinancialReporter + Start the financial reporter (Management Reporter 2012) service + + .PARAMETER DMF + Start the Data Management Framework service + + .PARAMETER OnlyStartTypeAutomatic + Instruct the cmdlet to filter out services that are set to manual start or disabled + + .PARAMETER ShowOriginalProgress + Instruct the cmdlet to show the standard output in the console + + Default is $false which will silence the standard output + + .EXAMPLE + PS C:\> Start-D365EnvironmentV2 + + This will run the cmdlet with the default parameters. + Default is "-All". + This will start all D365FO services on the machine. + + .EXAMPLE + PS C:\> Start-D365EnvironmentV2 -OnlyStartTypeAutomatic + + This will start all D365FO services on the machine that are configured for Automatic startup. + It will exclude all services that are either manual or disabled in their startup configuration. + + .EXAMPLE + PS C:\> Start-D365EnvironmentV2 -ShowOriginalProgress + + This will run the cmdlet with the default parameters. + Default is "-All". + This will start all D365FO services on the machine. + The progress of starting the different services will be written to the console / host. + + .EXAMPLE + PS C:\> Start-D365EnvironmentV2 -All + + This will start all D365FO services on the machine. + + .EXAMPLE + PS C:\> Start-D365EnvironmentV2 -Aos -Batch + + This will start the Aos & Batch D365FO services on the machine. + + .EXAMPLE + PS C:\> Start-D365EnvironmentV2 -FinancialReporter -DMF + + This will start the FinancialReporter and DMF services on the machine. + + .EXAMPLE + PS C:\> Enable-D365Exception + PS C:\> Start-D365EnvironmentV2 + + This will run the cmdlet with the default parameters. + Default is "-All". + This will start all D365FO services on the machine. + If a service does not start, it will throw an exception. + + .NOTES + Author: Vincent Verweij (@VincentVerweij) + +#> +function Start-D365EnvironmentV2 { + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidDefaultValueSwitchParameter", "")] + [CmdletBinding(DefaultParameterSetName = 'Default')] + + param ( + [Parameter(Mandatory = $false, ParameterSetName = 'Default', Position = 1 )] + [switch] $All = $true, + + [Parameter(Mandatory = $false, ParameterSetName = 'Specific', Position = 1 )] + [switch] $Aos, + + [Parameter(Mandatory = $false, ParameterSetName = 'Specific', Position = 2 )] + [switch] $Batch, + + [Parameter(Mandatory = $false, ParameterSetName = 'Specific', Position = 3 )] + [switch] $FinancialReporter, + + [Parameter(Mandatory = $false, ParameterSetName = 'Specific', Position = 4 )] + [switch] $DMF, + + [switch] $OnlyStartTypeAutomatic, + + [switch] $ShowOriginalProgress + ) + + Import-Module -Name "WebAdministration" -Scope "Local" + + if ($PSCmdlet.ParameterSetName -eq "Specific") { + $All = $false + } + + if ( (-not ($All)) -and (-not ($Aos)) -and (-not ($Batch)) -and (-not ($FinancialReporter)) -and (-not ($DMF))) { + Write-PSFMessage -Level Host -Message "You have to use at least one switch when running this cmdlet. Please run the cmdlet again." + Stop-PSFFunction -Message "Stopping because of missing parameters" + return + } + + $ComputerName = @($env:computername) + $warningActionValue = "SilentlyContinue" + if ($ShowOriginalProgress) { $warningActionValue = "Continue" } + + $Params = $PSBoundParameters | ConvertTo-PSFHashtable -ReferenceCommand Get-ServiceList $psItemExceptionsFromStartServices = New-Object -TypeName "System.Collections.ArrayList" $didServiceStartThrowException = $false @@ -172,4 +306,4 @@ function Start-D365EnvironmentV2 { Write-PSFMessage -Level Host -Message "Something went wrong while starting the service(s) on computer '$($ComputerName)'" -Exception $psItemException } } -} \ No newline at end of file +} From fbb16aee91d19b6689180feb30eb86fcec70665d Mon Sep 17 00:00:00 2001 From: pavankadabala-png Date: Mon, 13 Jul 2026 10:07:00 -0400 Subject: [PATCH 04/10] refactor: use ConvertTo-PSFHashtable for splatting in Start-D365EnvironmentV2 (#870) --- .../functions/start-d365environmentv2.ps1 | 136 ------------------ 1 file changed, 136 deletions(-) diff --git a/d365fo.tools/functions/start-d365environmentv2.ps1 b/d365fo.tools/functions/start-d365environmentv2.ps1 index 9a4538bd..61edbad9 100644 --- a/d365fo.tools/functions/start-d365environmentv2.ps1 +++ b/d365fo.tools/functions/start-d365environmentv2.ps1 @@ -83,142 +83,6 @@ .NOTES Author: Vincent Verweij (@VincentVerweij) -#> -function Start-D365EnvironmentV2 { - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidDefaultValueSwitchParameter", "")] - [CmdletBinding(DefaultParameterSetName = 'Default')] - - param ( - [Parameter(Mandatory = $false, ParameterSetName = 'Default', Position = 1 )] - [switch] $All = $true, - - [Parameter(Mandatory = $false, ParameterSetName = 'Specific', Position = 1 )] - [switch] $Aos, - - [Parameter(Mandatory = $false, ParameterSetName = 'Specific', Position = 2 )] - [switch] $Batch, - - [Parameter(Mandatory = $false, ParameterSetName = 'Specific', Position = 3 )] - [switch] $FinancialReporter, - - [Parameter(Mandatory = $false, ParameterSetName = 'Specific', Position = 4 )] - [switch] $DMF, - - [switch] $OnlyStartTypeAutomatic, - - [switch] $ShowOriginalProgress - ) - - Import-Module -Name "WebAdministration" -Scope "Local" - - if ($PSCmdlet.ParameterSetName -eq "Specific") { - $All = $false - } - - if ( (-not ($All)) -and (-not ($Aos)) -and (-not ($Batch)) -and (-not ($FinancialReporter)) -and (-not ($DMF))) { - Write-PSFMessage -Level Host -Message "You have to use at least one switch when running this cmdlet. Please run the cmdlet again." - Stop-PSFFunction -Message "Stopping because of missing parameters" - return - } - - $ComputerName = @($env:computername) - $warningActionValue = "SilentlyContinue" - if ($ShowOriginalProgress) { $warningActionValue = "Continue" } - - $Params = $PSBoundParameters | ConvertTo-PSFHashtable -ReferenceCommand Get-ServiceList - - $psItemExceptionsFromStartServices = New-Object -TypeName "System.Collections.ArrayList" - $didServiceStartThrowException = $false - - $Services = Get-ServiceList @Params - - Write-PSFMessage -Level Verbose -Message "Working against: $ComputerName - starting services" - $temp = Get-Service -ComputerName $ComputerName -Name $Services -ErrorAction SilentlyContinue -<# - .SYNOPSIS - Cmdlet to start the different services in a Dynamics 365 Finance & Operations environment - - .DESCRIPTION - Can start all relevant services that is running in a D365FO environment - - .PARAMETER All - Set when you want to start all relevant services - - Includes: - Aos - Batch - Financial Reporter - Data Management Framework - - .PARAMETER Aos - Start the Aos (iis) service - - .PARAMETER Batch - Start the batch service - - .PARAMETER FinancialReporter - Start the financial reporter (Management Reporter 2012) service - - .PARAMETER DMF - Start the Data Management Framework service - - .PARAMETER OnlyStartTypeAutomatic - Instruct the cmdlet to filter out services that are set to manual start or disabled - - .PARAMETER ShowOriginalProgress - Instruct the cmdlet to show the standard output in the console - - Default is $false which will silence the standard output - - .EXAMPLE - PS C:\> Start-D365EnvironmentV2 - - This will run the cmdlet with the default parameters. - Default is "-All". - This will start all D365FO services on the machine. - - .EXAMPLE - PS C:\> Start-D365EnvironmentV2 -OnlyStartTypeAutomatic - - This will start all D365FO services on the machine that are configured for Automatic startup. - It will exclude all services that are either manual or disabled in their startup configuration. - - .EXAMPLE - PS C:\> Start-D365EnvironmentV2 -ShowOriginalProgress - - This will run the cmdlet with the default parameters. - Default is "-All". - This will start all D365FO services on the machine. - The progress of starting the different services will be written to the console / host. - - .EXAMPLE - PS C:\> Start-D365EnvironmentV2 -All - - This will start all D365FO services on the machine. - - .EXAMPLE - PS C:\> Start-D365EnvironmentV2 -Aos -Batch - - This will start the Aos & Batch D365FO services on the machine. - - .EXAMPLE - PS C:\> Start-D365EnvironmentV2 -FinancialReporter -DMF - - This will start the FinancialReporter and DMF services on the machine. - - .EXAMPLE - PS C:\> Enable-D365Exception - PS C:\> Start-D365EnvironmentV2 - - This will run the cmdlet with the default parameters. - Default is "-All". - This will start all D365FO services on the machine. - If a service does not start, it will throw an exception. - - .NOTES - Author: Vincent Verweij (@VincentVerweij) - #> function Start-D365EnvironmentV2 { [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")] From 86b9e54204b304c7d4dd05bc16de549fa8682e17 Mon Sep 17 00:00:00 2001 From: pavankadabala-png Date: Mon, 13 Jul 2026 10:09:56 -0400 Subject: [PATCH 05/10] refactor: use ConvertTo-PSFHashtable for splatting in Stop-D365Environment (#870) --- d365fo.tools/functions/stop-d365environment.ps1 | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/d365fo.tools/functions/stop-d365environment.ps1 b/d365fo.tools/functions/stop-d365environment.ps1 index 4f212d07..2e5cf438 100644 --- a/d365fo.tools/functions/stop-d365environment.ps1 +++ b/d365fo.tools/functions/stop-d365environment.ps1 @@ -124,10 +124,7 @@ function Stop-D365Environment { $warningActionValue = "SilentlyContinue" if ($ShowOriginalProgress) { $warningActionValue = "Continue" } - $Params = Get-DeepClone $PSBoundParameters - if ($Params.ContainsKey("ComputerName")) { $null = $Params.Remove("ComputerName") } - if ($Params.ContainsKey("ShowOriginalProgress")) { $null = $Params.Remove("ShowOriginalProgress") } - if ($Params.ContainsKey("Kill")) { $null = $Params.Remove("Kill") } + $Params = $PSBoundParameters | ConvertTo-PSFHashtable -ReferenceCommand Get-ServiceList $Services = Get-ServiceList @Params @@ -154,4 +151,4 @@ function Stop-D365Environment { Write-PSFMessage -Level Verbose "Results are: $Results" -Target ($Results.Name -join ",") $Results | Select-PSFObject -TypeName "D365FO.TOOLS.Environment.Service" Server, DisplayName, Status, StartType, Name -} \ No newline at end of file +} From d8d837a1039d1e7a6c963dff067ae34db8c15adb Mon Sep 17 00:00:00 2001 From: pavankadabala-png Date: Mon, 13 Jul 2026 10:11:15 -0400 Subject: [PATCH 06/10] refactor: use ConvertTo-PSFHashtable for splatting in Get-AzureServiceObjective (#870) --- .../internal/functions/get-azureserviceobjective.ps1 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/d365fo.tools/internal/functions/get-azureserviceobjective.ps1 b/d365fo.tools/internal/functions/get-azureserviceobjective.ps1 index 6b2b3dcb..10cbf6d9 100644 --- a/d365fo.tools/internal/functions/get-azureserviceobjective.ps1 +++ b/d365fo.tools/internal/functions/get-azureserviceobjective.ps1 @@ -54,8 +54,7 @@ function Get-AzureServiceObjective { [switch] $EnableException ) - $Params = Get-DeepClone $PSBoundParameters - if($Params.ContainsKey("EnableException")){$null = $Params.Remove("EnableException")} + $Params = $PSBoundParameters | ConvertTo-PSFHashtable -ReferenceCommand Get-SqlCommand $sqlCommand = Get-SqlCommand @Params -TrustedConnection $false @@ -99,4 +98,4 @@ function Get-AzureServiceObjective { Stop-PSFFunction -Message "Stopping because of errors." -Exception $([System.Exception]::new($($messageString -replace '<[^>]+>', ''))) -ErrorRecord $_ return } -} \ No newline at end of file +} From 6a0a4c88d94d4317dfbb52f232e35ae5bbe88093 Mon Sep 17 00:00:00 2001 From: pavankadabala-png Date: Mon, 13 Jul 2026 10:12:19 -0400 Subject: [PATCH 07/10] refactor: use ConvertTo-PSFHashtable for splatting in Get-InstanceValues (#870) --- d365fo.tools/internal/functions/get-instancevalues.ps1 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/d365fo.tools/internal/functions/get-instancevalues.ps1 b/d365fo.tools/internal/functions/get-instancevalues.ps1 index 9836a18e..9ee2def1 100644 --- a/d365fo.tools/internal/functions/get-instancevalues.ps1 +++ b/d365fo.tools/internal/functions/get-instancevalues.ps1 @@ -62,8 +62,7 @@ function Get-InstanceValues { [switch] $EnableException ) - $Params = Get-DeepClone $PSBoundParameters - if($Params.ContainsKey("EnableException")){$null = $Params.Remove("EnableException")} + $Params = $PSBoundParameters | ConvertTo-PSFHashtable -ReferenceCommand Get-SqlCommand $sqlCommand = Get-SqlCommand @Params @@ -110,4 +109,4 @@ function Get-InstanceValues { $sqlCommand.Connection.Close() $sqlCommand.Dispose() } -} \ No newline at end of file +} From b6ed6a55b239fb38c269c7dc98119e63bc8c7e1d Mon Sep 17 00:00:00 2001 From: pavankadabala-png Date: Mon, 13 Jul 2026 10:13:52 -0400 Subject: [PATCH 08/10] refactor: use ConvertTo-PSFHashtable for splatting in Invoke-ClearAzureSpecificObjects (#870) --- .../internal/functions/invoke-clearazurespecificobjects.ps1 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/d365fo.tools/internal/functions/invoke-clearazurespecificobjects.ps1 b/d365fo.tools/internal/functions/invoke-clearazurespecificobjects.ps1 index 01c2e56e..c9905014 100644 --- a/d365fo.tools/internal/functions/invoke-clearazurespecificobjects.ps1 +++ b/d365fo.tools/internal/functions/invoke-clearazurespecificobjects.ps1 @@ -57,8 +57,7 @@ Function Invoke-ClearAzureSpecificObjects { [switch] $EnableException ) - $Params = Get-DeepClone $PSBoundParameters - if($Params.ContainsKey("EnableException")){$null = $Params.Remove("EnableException")} + $Params = $PSBoundParameters | ConvertTo-PSFHashtable -ReferenceCommand Get-SqlCommand $sqlCommand = Get-SqlCommand @Params -TrustedConnection $false @@ -90,4 +89,4 @@ Function Invoke-ClearAzureSpecificObjects { $sqlCommand.Dispose() } -} \ No newline at end of file +} From e227b0a5189868034de569aff9111f8d3a01e738 Mon Sep 17 00:00:00 2001 From: pavankadabala-png Date: Mon, 13 Jul 2026 10:14:57 -0400 Subject: [PATCH 09/10] refactor: use ConvertTo-PSFHashtable for splatting in Invoke-ClearSqlSpecificObjects (#870) --- .../internal/functions/invoke-clearsqlspecificobjects.ps1 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/d365fo.tools/internal/functions/invoke-clearsqlspecificobjects.ps1 b/d365fo.tools/internal/functions/invoke-clearsqlspecificobjects.ps1 index ba30dec7..1cf989b8 100644 --- a/d365fo.tools/internal/functions/invoke-clearsqlspecificobjects.ps1 +++ b/d365fo.tools/internal/functions/invoke-clearsqlspecificobjects.ps1 @@ -63,8 +63,7 @@ Function Invoke-ClearSqlSpecificObjects { [switch] $EnableException ) - $Params = Get-DeepClone $PSBoundParameters - if($Params.ContainsKey("EnableException")){$null = $Params.Remove("EnableException")} + $Params = $PSBoundParameters | ConvertTo-PSFHashtable -ReferenceCommand Get-SqlCommand $sqlCommand = Get-SqlCommand @Params @@ -94,4 +93,4 @@ Function Invoke-ClearSqlSpecificObjects { $sqlCommand.Dispose() } -} \ No newline at end of file +} From 7e216e8275ced1dfbb65b3e769fa4845acee09c9 Mon Sep 17 00:00:00 2001 From: pavankadabala-png Date: Tue, 21 Jul 2026 22:16:15 -0400 Subject: [PATCH 10/10] refactor: use ConvertTo-PSFHashtable for splatting in Restart-D365Environment (#870) --- d365fo.tools/functions/restart-d365environment.ps1 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/d365fo.tools/functions/restart-d365environment.ps1 b/d365fo.tools/functions/restart-d365environment.ps1 index 79c92569..8a474c68 100644 --- a/d365fo.tools/functions/restart-d365environment.ps1 +++ b/d365fo.tools/functions/restart-d365environment.ps1 @@ -111,8 +111,7 @@ function Restart-D365Environment { Stop-D365Environment @PSBoundParameters | Format-Table - $parms = Get-DeepClone $PSBoundParameters - if ($parms.ContainsKey("Kill")) { $null = $Params.Remove("Kill") } + $parms = $PSBoundParameters | ConvertTo-PSFHashtable -ReferenceCommand Start-D365Environment Start-D365Environment @parms | Format-Table -} \ No newline at end of file +}