Adds support to provide user and domain with @ separated

This commit is contained in:
Lord Hepipud 2023-05-26 14:17:26 +02:00
parent 389db1bb6c
commit 00c3d67967
2 changed files with 7 additions and 1 deletions

View file

@ -19,6 +19,9 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
* [#617](https://github.com/Icinga/icinga-powershell-framework/issues/617) Fixes failing calls for plugins which use a switch argument like `-NoPerfData`, which is followed directly by the `-ThresholdInterval` argument
* [#621](https://github.com/Icinga/icinga-powershell-framework/pull/621) Fixes `-ThresholdInterval` key detection on newer systems
### Enhancements
* [#623](https://github.com/Icinga/icinga-powershell-framework/issues/623) Adds support to provide the Icinga service user written as `user@domain`
### Enhancements

View file

@ -16,7 +16,10 @@ function Set-IcingaServiceUser()
return $FALSE;
}
if ($User.Contains('\') -eq $FALSE) {
if ($User.Contains('@')) {
$UserData = $User.Split('@');
$User = [string]::Format('{0}\{1}', $UserData[1], $UserData[0]);
} elseif ($User.Contains('\') -eq $FALSE) {
$User = [string]::Format('.\{0}', $User);
}