none
can I Import-Module Smb* in windows server 2008 r2 RRS feed

  • Question

  • Working with an older server OS to be upgraded eventually

    but for now I need to make smb share for AD accounts is there a way to 

    Import-Module Smb*

    so this will work

    Get-ADGroupMember -Identity "Domain Users" -Recursive | select-object saMAccountName | ForEach-Object {New-SMBShare -Name $_.saMAccountName –Path “c:\shares\” ` –ContinuouslyAvailable ` –FullAccess domain\admingroup  ` -ChangeAccess $_.saMAccountName ` }

    • Moved by Bill_Stewart Wednesday, December 12, 2018 9:38 PM Unanswerable drive-by question
    Monday, September 10, 2018 12:43 AM

All replies

  • The issue with groups is that they contain users and groups.  The issue with "Recurse" is that the same accounts may occur numerous times.

    You need to rethink what you are trying to do.

    Get-ADGroupMember -Identity 'Domain Users'|
        where{ $_.objectClass -eq 'User' } |
        ForEach-Object {
            New-SMBShare -Name $_.saMAccountName @splat -ChangeAccess $_.saMAccountName
        }

    I strongly recommend against using the 'Domain Users" group as a template.


    \_(ツ)_/

    Monday, September 10, 2018 1:00 AM