So, let’s continue blogging about my PowerShell tools. I’m browsing throughout my corporate network using PowerShell mostly. The biggest problem with this approach is that when you go to the network share (by UNC path) you can’t step on \\server_name without a particular share. For example, you can set location to \\my_server\my_share, but you can’t to \\my_server. To find shares what I used to do was:

  • open Explorer
  • copy required share name
  • copy share name
  • go to terminal
  • paste my share name

As you can see it’s a bit annoying. I struggled a lot with that and tried to find out a native workaround, but with no success. Finally, I made coffee, sat in front of my laptop and started thinking how Explorer acquires network shares, it’s impossible if it uses some internal APIs to which you don’t have access. net view. Of course!! Oh my god! The answer was right under my nose. Therefore, I wrote the simplest script. It’s not a sophisticated solution, but it works! Next script is quite a useful shortcut to acquire server shares through net view.

When you sourced this script, to get shares run the following code:

Get-Shares \\my_server

Related Posts

devops

Group-ByMonth.ps1

Bare PowerShell is quite odd if you’re using it on daily basis. There are no out-of-box such functions as add to environment path, get server shares, or convert to YAML. Eventually, you create a batch Read more…

devops

DDL and SQL Server Transactional Replication

Disclaimer: This post is not about detailed how-to and not about replication at Microsoft SQL Server at all, but is about my experience and faults. Chapter 1. Never run alter column on replicated table (almost Read more…

asp.net

IIS Web Deploy by VSTS

A task is simple: release my site to IIS. Web Applications can be released through several ways. Usually it is better to choose web deploy. Web deploy is a good technology, but in my opinion Read more…