snap
This commit is contained in:
parent
e79af0ce90
commit
32e5c19230
25
AddUser.ps1
25
AddUser.ps1
@ -6,7 +6,9 @@ param (
|
||||
[string]
|
||||
$Server,
|
||||
[string]
|
||||
$ProjectName
|
||||
$ProjectName,
|
||||
[string]
|
||||
$Type = "RO"
|
||||
)
|
||||
|
||||
$User = $null
|
||||
@ -29,7 +31,7 @@ if($PSBoundParameters.ContainsKey("Server")){
|
||||
$User = Get-ADUser -Identity $Identity
|
||||
}
|
||||
|
||||
if($User -eq $null){
|
||||
if($null -eq $User){
|
||||
throw "Didn't find the user, aborting"
|
||||
return
|
||||
}
|
||||
@ -40,15 +42,26 @@ if($PSBoundParameters.ContainsKey("Server")){
|
||||
$Group = . .\GetProjects.ps1
|
||||
}
|
||||
|
||||
if($Group -eq $null){
|
||||
throw "Can't find Project"
|
||||
if($null -eq $Group){
|
||||
throw "Can't find Project, aborting"
|
||||
return
|
||||
}
|
||||
|
||||
$targeGroup =$null
|
||||
|
||||
if($PSBoundParameters.ContainsKey("Server")){
|
||||
Add-ADGroupMember -Identity -Members $User -Server $Server
|
||||
$targeGroup = . .\GetRoles.ps1 -Server $Server -ProjectName $ProjectName
|
||||
} else {
|
||||
Add-ADGroupMember -Identity -Members $User
|
||||
$targeGroup = . .\GetRoles.ps1 -ProjectName $ProjectName
|
||||
}
|
||||
|
||||
if($null -eq $Group){
|
||||
throw "Filter for Type was empty, aborting"
|
||||
return
|
||||
}
|
||||
|
||||
if($PSBoundParameters.ContainsKey("Server")){
|
||||
Add-ADGroupMember -Identity $targeGroup -Members $User -Server $Server
|
||||
} else {
|
||||
Add-ADGroupMember -Identity $targeGroup -Members $User
|
||||
}
|
@ -1,7 +1,9 @@
|
||||
[CmdletBinding()]
|
||||
param (
|
||||
[string]
|
||||
$Server
|
||||
$Server,
|
||||
[string]
|
||||
$ProjectName
|
||||
)
|
||||
|
||||
$Projects=$null
|
||||
|
Loading…
Reference in New Issue
Block a user