does anybody know the equivalent in PowerShell of the following windows command:
net use \\server_name\share_name /delete
I'd like to disconnect from the shares from powershell, included the ones that are not mapped as shared drives.
does anybody know the equivalent in PowerShell of the following windows command:
net use \\server_name\share_name /delete
I'd like to disconnect from the shares from powershell, included the ones that are not mapped as shared drives.
WMI should do the trick:
ps> get-wmiobject -computer server -class win32_share -credential $creds | `
where-object { $_.name -eq "sharedfolder" } | foreach-object { $_.delete() }