Co-authored-by: tg95 <tg95@noreply.localhost> Co-authored-by: Taarly <lownslow.music@gmail.com> Co-authored-by: taarly <lownslow.music@gmail.com> Co-authored-by: ViperioN1339 <stezel1989@outlook.de> Co-authored-by: MuchenTuchen31 <yasin.mine31@gmail.com> Reviewed-on: https://git.eckertplayground.de/taarly/PHP_AdminTool_Projekt/pulls/28 Co-authored-by: blaerf <blaerf@gmx.de> Co-committed-by: blaerf <blaerf@gmx.de>
18 lines
632 B
PowerShell
18 lines
632 B
PowerShell
# Returns JSON with information about the environment and AD module availability
|
|
Try {
|
|
$actor = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
|
|
} Catch {
|
|
$actor = $null
|
|
}
|
|
|
|
# Does the ActiveDirectory module exist?
|
|
$module = Get-Module -ListAvailable -Name ActiveDirectory -ErrorAction SilentlyContinue
|
|
$hasModule = $module -ne $null
|
|
|
|
# Is New-ADUser available?
|
|
$canNewAdUser = (Get-Command New-ADUser -ErrorAction SilentlyContinue) -ne $null
|
|
|
|
$output = @{ success = $true; actor = $actor; module_installed = $hasModule; can_new_aduser = $canNewAdUser }
|
|
Write-Output ($output | ConvertTo-Json -Compress)
|
|
exit 0
|