Created
February 27, 2019 13:33
-
-
Save freakydinde/8c112f275d83ffaa1b3811ab5ffdd911 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[CmdletBinding()] | |
Param( [Parameter(Mandatory=$false,Position=0)][string]$HoL =$(Read-Host '1)Benutzer Hinzufügen 2)Benutzer Löschen 3)Gruppe Hinzufügen 4)Gruppe Löschen 5) Benutzer in eine Gruppe hinzufügen 6) Benutzer aus einer Gruppe Entfernen'), | |
[Parameter(Mandatory=$false,Position=1)][string]$Benutzer =$(Read-Host 'Benutzernamen eingeben'), | |
[Parameter(Mandatory=$false,Position=2)][string]$Gruppe =$(Read-Host 'Gruppennamen eingeben'), | |
[Parameter(Mandatory=$false,Position=3)][Security.SecureString]$Password =$(ConvertTo-SecureString (Read-Host 'Password eingeben') -AsPlainText -Force), | |
[Parameter(Mandatory=$false,Position=4)][string]$BenInGru =$(Add-LocalGroupMember $Gruppe $Benutzer), | |
[Parameter(Mandatory=$false,Position=5)][string]$BenAusGru =$(Remove-LocalGroupMember $Gruppe $Benutzer), | |
[Parameter(Mandatory=$false,Position=6)][string]$SuchG =$(Get-LocalGroup -Filter {Name -eq $Gruppe}) , | |
[Parameter(Mandatory=$false,Position=7)][string]$SuchB =$(Get-LocalUser -Filter {Name -eq $Benutzer}), | |
[Parameter(Mandatory=$false,Position=8)][string]$HinzuG =$(New-LocalGroup $Gruppe), | |
[Parameter(Mandatory=$false,Position=9)][string]$HinzuB =$(New-LocalUser $Benutzer -Password $Password ), | |
[Parameter(Mandatory=$false,Position=10)][string]$EntfG =$(Remove-LocalGroup $Gruppe), | |
[Parameter(Mandatory=$false,Position=11)][string]$EntfB =$(Remove-LocalUser $Benutzer) ) | |
switch($HoL) | |
{ | |
1 {write-host "ja $HinzuB"} | |
2 {write-host "ja $EntfB"} | |
3 {write-host "ja $Gruppe $HinzuG"} | |
4 {write-host "ja $EntfG"} | |
# ?? you are trying to send $HinzuG or $HinzuB or $BenInGru value to the pipeline or host ? | |
5 { if ($SuchG){} else{$HinzuG} | |
if ($SuchB){} else{$HinzuB} | |
$BenInGru | |
} | |
# ?? send $BenAusGru value to the pipeline or host ? | |
6 {$BenAusGru} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment