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 path results: < / P> $ name = "shared" $ share = (gwmi Win32_Share |? {$ _ .name -key $ name} $ path = $ share.Path + "\ scripts \ test" < / Code>

Note: You -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

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -