none
Get-PSDrive - match server name string RRS feed

  • Question

  • Trying to determine a method to target/trigger a group policy item  or logon script based on whether or not a user has any mapped drives to a specific server.

    In the scenario I'm looking at, only Windows 10 clients that map a drive to an old Windows 2008R2 Server (server2) will need to have SMB V1 re-enabled.

    Is there an easy way to filter and validate the results from Get-PSDrive  to trigger the client to enable the feature (ie.  Enable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol or apply registry key) if it finds the string "server2" in the results or is there an obvious, more sensible way of accomplishing this already that I've completely overlooked?


    Get-PSDrive | select DisplayRoot

    DisplayRoot
    -----------

    \\server1\share1
    \\server1\share2
    \\server1\share3
    \\server2\share1
    \\server3\share1

    • Moved by Bill_Stewart Monday, April 30, 2018 9:40 PM Abandoned
    Tuesday, February 27, 2018 11:12 PM

All replies

  • You can search the target server event log for connections from clients.

    You should NOT use SMBv1 as it is a serious security hole.   Windows 10 does not require this and 2008 fully support v2.


    \_(ツ)_/

    Tuesday, February 27, 2018 11:23 PM
  • This would need to be a client side processed script. This is only affecting a relatively small, albeit random group of machines on the network as Win10 1709 does not have SMB V1 enabled by default.  This is only an interim measure to target machines that still require access to applications on a few older servers until they are decommissioned after  an upcoming migration.

    https://support.microsoft.com/en-ca/help/4034314/smbv1-is-not-installed-windows-10-and-windows-server-version-1709


    Tuesday, February 27, 2018 11:43 PM
  • All of the machines that map a drive to the servers in question will be listed in the servers eventlog.  It would just take one command from anywhere to extract the information.

    \_(ツ)_/

    Tuesday, February 27, 2018 11:50 PM
  • Well that's all fine and good, but getting back to the point.... is there a simple way to filter/format  the output of Get-PSDrive to either return just a desired block of text such as just the server name from the mapped drives , or a true/false result based on matching a string?
    Wednesday, February 28, 2018 10:35 PM
  • THat is easy to answer.

    User "Where-Object" to filter the drives by the "DisplayRoot".


    \_(ツ)_/

    Wednesday, February 28, 2018 10:40 PM