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

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -