1

I need a way to enumerate the SMB shares of a remote, non-Windows system while using PowerShell on my Windows 7 system.

The file server I'm checking is not running a Windows OS. However, I need to get a list of the SMB shares on that server using PowerShell on my Windows 7 system so that I can pass the list on for further processing in a script.

Most of the solutions I've found for enumerating SMB shares on remote systems with PowerShell use one of two options that are unavailable to me.

  1. SMB-related PowerShell modules. This would be great, but they're not available until Windows 8.1.
  2. WMI. This is only good for Windows-based remote targets, where remote WMI access is permitted. That is not the case I'm dealing with.

What other options do I have here?

Assume vanilla Windows 7 SP 1. Third-party software/modules are not an option. PowerShell 4.0 is available to me, but compatibility down to 2.0 is preferred.

1 Answer 1

0

You can use the WinNT ADSI provider to do this:

$lanman = [adsi]"WinNT://server123/lanmanserver,fileservice"
$lanman.children | foreach {[string]($_.name + "`t" + $_.path)}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .