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 +} 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 +} 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 +} diff --git a/d365fo.tools/functions/start-d365environmentv2.ps1 b/d365fo.tools/functions/start-d365environmentv2.ps1 index 7933a17f..61edbad9 100644 --- a/d365fo.tools/functions/start-d365environmentv2.ps1 +++ b/d365fo.tools/functions/start-d365environmentv2.ps1 @@ -126,9 +126,7 @@ 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 @@ -172,4 +170,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 +} 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 +} 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 +} 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 +} 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 +} 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 +}