added mitigation for accidentally getting a list or array
This commit is contained in:
parent
2248f91d25
commit
67b822938e
@ -15,6 +15,9 @@ if($PSBoundParameters.ContainsKey("Server")){
|
|||||||
|
|
||||||
if($PSBoundParameters.ContainsKey("ProjectName")){
|
if($PSBoundParameters.ContainsKey("ProjectName")){
|
||||||
$Projects = $Projects | Where-Object Name -Match $ProjectName
|
$Projects = $Projects | Where-Object Name -Match $ProjectName
|
||||||
|
if($ProjectName.Count -ge 1){
|
||||||
|
$Projects=$Projects[0]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $Projects | Get-ADGroupMember | Where-Object Name -Match "ACL.*"
|
return $Projects | Get-ADGroupMember | Where-Object Name -Match "ACL.*"
|
20
GetRoles.ps1
20
GetRoles.ps1
@ -7,14 +7,24 @@ param (
|
|||||||
)
|
)
|
||||||
|
|
||||||
$Projects=$null
|
$Projects=$null
|
||||||
if($PSBoundParameters.ContainsKey("Server")){
|
if($PSBoundParameters.ContainsKey("ProjectName")){
|
||||||
$Projects = . .\GetProjects.ps1 -Server $Server
|
if($PSBoundParameters.ContainsKey("Server")){
|
||||||
} else {
|
$Projects = . .\GetProjects.ps1 -Server $Server
|
||||||
$Projects = . .\GetProjects.ps1
|
} else {
|
||||||
|
$Projects = . .\GetProjects.ps1
|
||||||
|
}
|
||||||
|
} else{
|
||||||
|
if($PSBoundParameters.ContainsKey("Server")){
|
||||||
|
$Projects = . .\GetProjects.ps1 -Server $Server
|
||||||
|
} else {
|
||||||
|
$Projects = . .\GetProjects.ps1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($PSBoundParameters.ContainsKey("ProjectName")){
|
if($PSBoundParameters.ContainsKey("ProjectName")){
|
||||||
$Projects = $Projects | Where-Object Name -Match $ProjectName
|
$Projects = $Projects | Where-Object Name -Match $ProjectName
|
||||||
|
if($ProjectName.Count -ge 1){
|
||||||
|
$Projects=$Projects[0]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $Projects | Get-ADGroupMember | Where-Object Name -Match "GR.*"
|
return $Projects | Get-ADGroupMember | Where-Object Name -Match "GR.*"
|
Loading…
Reference in New Issue
Block a user