In at the moment’s weblog publish I present the best way to retrieve all community shares from all servers in an Energetic Listing area to get a pleasant record within the output. This script is used to doc your Energetic Listing surroundings. Let’s get began.
Retrieve all Server by Title
Initially, we have to retrieve the server names.
# Retrieve Server Names
$server = Get-ADComputer -Filter 'operatingsystem -like "*server*"' | Choose-Object -ExpandProperty Title
Brief evaluate.
Nice!
Retrieving all Share Names of all Servers
Now the occasion begins. Since we’ve got all of the server names, we are able to use Invoke-Command and Get-SmbShare to retrieve all of the shares.
Microsoft MVP on PowerShell [2018-2023], IT-Coach, IT-Guide, MCSE: Cloud Platform and Infrastructure, Cisco Licensed Academy Teacher.
View all posts by Patrick Gruenauer