mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2026-02-03 12:19:29 -05:00
22 lines
454 B
PowerShell
22 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;
|
||
|
|
}
|
||
|
|
}
|