Quantcast
Channel: /r/powershell – How to Code .NET
Viewing all articles
Browse latest Browse all 8793

Auditing Fileshares from an OU

$
0
0

Novice here.

We’re currently trying to figure out how to generate a report that targets a specific OU and returns a list of all file shares and the computer name.

My logic goes something like this, but I’m getting the error “cannot validate argument parameter ‘ComputerName’. The argument is null or empty.

I know I’m in the ballpark, but I think I’ve been staring at this for too long.

Get-ADComputer -Filter * -SearchBase “OU=Site,DC=intranet,DC=Com” |

ForEach-Object {Get-WMIObject -name $computer -Query “SELECT * FROM Win32_Share” | FL}

| Export-csv -path C:ReportsSHARES.csv -NoTypeInformation

submitted by /u/20th_LVL_Wizard
[link] [comments]

The post Auditing Fileshares from an OU appeared first on How to Code .NET.


Viewing all articles
Browse latest Browse all 8793