尝试创建共享并为ms-DS-Group-Managed-Service-Account授予权限时出现以下问题:
New-SmbShare -Name "Test" -Path "C:\Users\*****\Desktop\Other" -FullAccess {Get-ADServiceAccount -Filter 'Name -like "*APP" -or Name -like "*SB"' | Select-Object -ExpandProperty Name}
显然,我遇到的问题是它无法检索服务帐户的帐户信息。有人可以引导我朝正确的方向吗?
以下方法代替了:
$ServiceAccount = Get-ADServiceAccount -Filter 'Name -like "*APP" -or Name -like "*SB"' | Select-Object -ExpandProperty Name
New-SmbShare -Name "Test" -Path "C:\Users\*****\Desktop\Other"
#Creating a share
ForEach ($Account in $ServiceAccounts) {
Grant-SmbShareAccess -Name "Test" -AccountName $Account -AccessRight Full -Confirm: $false