wmi - Local path from shared path: Powershell -
How to find the local path of a shared path
My shared path "\ somemachine \ shared \ script \ test" its local path "D: \ myshares \ scripts \ test"
Thanks! By using WMI, you can get a list of shares with your local path counterparts:
PS C: \ & gt; Name of Gwmi Win32_Share Path Description ---- ---- ----------- Admin $ C: \ Windows Remote Administrator C $ C: \ Default share IPC $ remote IPC
You will need to match your shared path to the property named, then to get the local path on that server, change it to use the property of the Note: You path
results: < / P> $ name = "shared" $ share = (gwmi Win32_Share |? {$ _ .name -key $ name} $ path = $ share.Path + "\ scripts \ test" < / Code>
-computer name Parameter can also run
gwmi
cmdlet to run an order against another computer, to provide you with valid certificate -Creditential
parameter. / P>
Comments
Post a Comment