icinga-powershell-framework/lib/core/tools/Set-IcingaPSLocation.psm1
2022-12-19 14:06:14 +01:00

21 lines
454 B
PowerShell

function Set-IcingaPSLocation()
{
param (
[string]$Path = (Get-Location)
);
if ([string]::IsNullOrEmpty($Path)) {
return;
}
if ((Test-Path $Path) -eq $FALSE) {
return;
}
[string]$IfWRootPath = Get-IcingaForWindowsRootPath;
[string]$CurrentPath = Get-Location;
if ($CurrentPath -Like ([string]::Format('{0}*', $Path))) {
Set-Location -Path $IfWRootPath;
}
}