WMIC Share Get

If you need to obtain a list of shared resources on a Microsoft Windows system, such as shared folders, you can use a Windows Management Instrumentation Command-line (WMIC) command, wmic share get. E.g., I saved some files from a Windows 10 workstation to the shared Users folder on a Windows 2012 server in a Windows domain, but I didn't see the files under the user's account in C:\Users or D:\Users on the server. When I ran the wmic share get caption,name,path command from a command prompt on the server, I could see that the sharename Users pointed to G:\ServerFolders\Users.

Microsoft Windows [Version 6.2.9200]
(c) 2012 Microsoft Corporation. All rights reserved.

C:\>wmic share get caption,name,path
Caption                                      Name                  Path
Remote Admin                                 ADMIN$                C:\Windows
Default share                                C$                    C:\
Active Directory Certificate Services share  CertEnroll            C:\Windows\system32\CertSrv\CertEnroll
Company                                      Company               G:\ServerFolders\Company
Default share                                D$                    D:\
File History Backups                         File History Backups  G:\ServerFolders\File History Backups
Folder Redirection                           Folder Redirection    G:\ServerFolders\Folder Redirection
Default share                                G$                    G:\
Remote IPC                                   IPC$
Logon server share                           NETLOGON              C:\Windows\SYSVOL\sysvol\Midland.local\SCRIPTS
Logon server share                           SYSVOL                C:\Windows\SYSVOL\sysvol
Users                                        Users                 G:\ServerFolders\Users


C:\>

If you would like to store the output in a file, you can use the command wmic /output:sharenames.txt share get caption,name,path. The file would be stored in the directory from which the command was run. You can specify a full path name in addition to the file name, e.g.:

wmic /output:c:\Users\public\documents\sharenames.txt share get caption,name,path

Enclose the path and file name in double quotes, if there is a space in either.

You can also specify a parameter to the command to send the output to the Windows clipboard, instead.

C:\>wmic /output /?

OUTPUT - Specifies the mode for output redirection.
USAGE:

/OUTPUT:<outputspec>
NOTE: <outputspec> ::= (STDOUT | CLIPBOARD | <filename>)
      STDOUT     - Output will be redirected to the STDOUT.
      CLIPBOARD  - Output will be copied on to CLIPBOARD.
      <filename> - Output will be written to the specified file.

NOTE: Enclose the switch value in  double quotes, if the value contains special  characters like '-' or '/'.


C:\>

Other parameters you can use with the wmic share get command are shown below:

C:\>wmic share get /?

Property get operations.
USAGE:

GET [<property list>] [<get switches>]
NOTE: <property list> ::= <property name> | <property name>,  <property list>

The following properties are available:
Property                                Type                    Operation
========                                ====                    =========
AccessMask                              N/A                     N/A
AllowMaximum                            N/A                     N/A
Description                             N/A                     N/A
InstallDate                             N/A                     N/A
MaximumAllowed                          N/A                     N/A
Name                                    N/A                     N/A
Path                                    N/A                     N/A
Status                                  N/A                     N/A
Type                                    N/A                     N/A

The following GET switches are available:

/VALUE                       - Return value.
/ALL(default)                - Return the data and metadata for the attribute.
/TRANSLATE:<table name>      - Translate output via values from <table name>.
/EVERY:<interval> [/REPEAT:<repeat count>] - Returns value every (X interval) seconds, If /REPEAT specified the command is ex
ecuted <repeat count> times.
/FORMAT:<format specifier>   - Keyword/XSL filename to process the XML results.

NOTE: Order of /TRANSLATE and /FORMAT switches influences the appearance of output.
Case1: If /TRANSLATE precedes /FORMAT, then translation of results will be followed by formatting.
Case2: If /TRANSLATE succeeds /FORMAT, then translation of the formatted results will be done.


C:\>

 

TechRabbit ad 300x250 newegg.com

Justdeals Daily Electronics Deals1x1 px

Valid HTML 4.01 Transitional

Created: January 10, 2016