We're trying to use PowerShell as a file-replication tool, but having an issue.
The source server is a Linux-based closed OS, where users, through a GUI, create multiple network shares, which are then accessible by the UNC path \\SERVERNAME\NETWORKSHARE. In the OS, of course, the NETWORKSHARE is actually located multiple levels deeper than the root.
We've talked to the developer of the OS, and they cannot/will not enable access to the root of the folder where all the NETWORKSHARE folders are stored.
I've turned to PowerShell to try and find a way. My initial thinking was to send a Get-ChildItem -Directory to \\SERVERNAME to grab all the NETWORKSHARES, and then pipe that to Copy-Item/Robocopy, but it doesn't work.
I know the server needs their own local (non-AD) credentials.
Is there a way to do what I want to do that I'm just not seeing ?
Thanks in advance!
The
net viewcommand with an IP will enumerate accessible SMB/Samba shares.This PowerShell script parses the output and returns a
[PSCustomObject]with Server and Share properties.Sample output: