ProjectManagementScripts/NewProject.ps1
2024-07-14 14:26:26 +02:00

30 lines
768 B
PowerShell

[CmdletBinding()]
param (
[string]
$ProjectName,
[string]
$Server
)
. .\Variables.ps1
$ret
$acl
$r
if($PSBoundParameters.ContainsKey("Server")){
$ret = New-ADGroup -Path $Projects -Server $Server -Name $ProjectName -GroupCategory Security -GroupScope Global
$acl = . .\AddProjectACL.ps1 -ProjectName $ProjectName -Server $Server
$r = . .\AddProjectRoles.ps1 -ProjectName $ProjectName -Server $Server
$ret | Add-ADGroupMember -Members $acl,$r
} else {
$ret = New-ADGroup -Path $Projects -Name $ProjectName -GroupCategory Security -GroupScope Global
$acl = . .\AddProjectACL.ps1 -ProjectName $ProjectName
$r = . .\AddProjectRoles.ps1 -ProjectName $ProjectName
$ret | Add-ADGroupMember -Members $acl,$r
}
return $ret