Compare commits
No commits in common. "b243ac2a36b84f5ec3a1e90d40e73d22f72041af" and "27548c5dc5af2bf2f5b4960b4768aea996560e41" have entirely different histories.
b243ac2a36
...
27548c5dc5
@ -12,14 +12,6 @@ $ret=$null
|
|||||||
$acls=$null
|
$acls=$null
|
||||||
$rs=$null
|
$rs=$null
|
||||||
|
|
||||||
$projPath=$BaseDirectory+$ProjectName
|
|
||||||
Write-Host $projPath
|
|
||||||
$testFolder = Test-Path -Path $projPath -PathType Container
|
|
||||||
|
|
||||||
if($testFolder){
|
|
||||||
throw "Directory already exists. Not creating Folder or Share"
|
|
||||||
}
|
|
||||||
|
|
||||||
if($PSBoundParameters.ContainsKey("ProjectName")){
|
if($PSBoundParameters.ContainsKey("ProjectName")){
|
||||||
if($PSBoundParameters.ContainsKey("Server")){
|
if($PSBoundParameters.ContainsKey("Server")){
|
||||||
$ret = New-ADGroup -Path $Projects -Server $Server -Name $ProjectName -GroupCategory Security -GroupScope Global -PassThru
|
$ret = New-ADGroup -Path $Projects -Server $Server -Name $ProjectName -GroupCategory Security -GroupScope Global -PassThru
|
||||||
@ -40,35 +32,22 @@ if($PSBoundParameters.ContainsKey("ProjectName")){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($PSBoundParameters.ContainsKey("Server")){
|
if($PSBoundParameters.ContainsKey("Server")){
|
||||||
$target = $acls | Where-Object Name -Match ".*-RW"
|
$target = $acls | Where-Object Name -Match ".*RW"
|
||||||
$member = $rs | Where-Object Name -Match ".*-RW"
|
$member = $rs | Where-Object Name -Match ".*RW"
|
||||||
Add-ADGroupMember -Identity $target -Members $member -Server $Server
|
Add-ADGroupMember -Identity $target -Members $member -Server $Server
|
||||||
$target = $acls | Where-Object Name -Match ".*-RO"
|
$target = $acls | Where-Object Name -Match ".*RW"
|
||||||
$member = $rs | Where-Object Name -Match ".*-RO"
|
$member = $rs | Where-Object Name -Match ".*RW"
|
||||||
Add-ADGroupMember -Identity $target -Members $member -Server $Server
|
Add-ADGroupMember -Identity $target -Members $member -Server $Server
|
||||||
} else {
|
} else {
|
||||||
$target = $acls | Where-Object Name -Match ".*-RW"
|
$target = $acls | Where-Object Name -Match ".*RW"
|
||||||
$member = $rs | Where-Object Name -Match ".*-RW"
|
$member = $rs | Where-Object Name -Match ".*RW"
|
||||||
Add-ADGroupMember -Identity $target -Members $member
|
Add-ADGroupMember -Identity $target -Members $member
|
||||||
$target = $acls | Where-Object Name -Match ".*-RO"
|
$target = $acls | Where-Object Name -Match ".*RW"
|
||||||
$member = $rs | Where-Object Name -Match ".*-RO"
|
$member = $rs | Where-Object Name -Match ".*RW"
|
||||||
Add-ADGroupMember -Identity $target -Members $member
|
Add-ADGroupMember -Identity $target -Members $member
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$folder = New-Item -Path $projPath -ItemType Directory
|
|
||||||
|
|
||||||
$ReadTarget = $acls | Where-Object Name -Match ".*RW"
|
|
||||||
$WriteTarget = $acls | Where-Object Name -Match ".*RO"
|
|
||||||
|
|
||||||
$Parameters = @{
|
|
||||||
Name=$ProjectName
|
|
||||||
Path=$projPath
|
|
||||||
}
|
|
||||||
|
|
||||||
$share = New-SmbShare @Parameters
|
|
||||||
$share|Set-SmbShare -FolderEnumerationMode AccessBased
|
|
||||||
|
|
||||||
|
|
||||||
return $ret
|
return $ret
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user