icinga-powershell-framework/lib/core/tools/Set-IcingaPSLocation.psm1

22 lines
454 B
PowerShell
Raw Normal View History

2022-12-19 08:06:14 -05:00
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;
}
}