Flash info

Prenez une longueur d'avance avec PowerShell. Faire ce choix c'est anticiper l'avenir des produits Microsoft mais aussi être plus performant dans son travail quotidien d'admin système.

 
Microsoft Most Valuable Professionals
Lister les partages
Écrit par Arnaud Petitjean   
04-01-2010

Voici une petite requête WMI simple mais efficace pour obtenir la liste des partages d'une machine :

PS > Get-WmiObject Win32_Share

Name         Path                                                      Description
----         ----                                                      -----------
ADMIN$       C:\Windows                                                Remote Admin
C$           C:\                                                       Default share
homes        C:\homes
IPC$                                                                   Remote IPC
NETLOGON     C:\Windows\SYSVOL\sysvol\powershell-scripting.com\SCRIPTS Logon server share
Profiles_UPM C:\Profiles_UPM
SYSVOL       C:\Windows\SYSVOL\sysvol                                  Logon server share

Pour obtenir les partages d'une machine distante, il suffit d'ajouter le paramètre -ComputerName MachineDistante :


PS > Get-WmiObject Win32_Share -Computer Serveur01
 

 

 
© 2013 PowerShell-Scripting.com