Hello,
I’m not very good with PS.
I need to share all users Home drive profile folders under their root file system share. I need to do this to enable some restore capability with a Hitachi product. Each profile folder simply needs to be share with Full control share permissions for ‘Everyone.’
I was able to get it working with the ‘New-Smbshare’ cmd.
This works-
New-smbshare -name TEST -path D:\PATH -FullAccess Everyone
Going further in trying to deal with all profile folders. Some root file systems could have a few hundred profile folders to share.
$RootShare = "\prdjcaveuchdi02.prod-am.ameritrade.com\c$\fs_jc_users_mz1\FS2-UsersYZ"
$FolderList = “zso824-Disabled” #((Get-ChildItem $RootShare ) |Sort Name).name
Exclude Disabled folders, folders that start with #, Exclude Files
ForEach ($Path in $FolderList){
$LongPath = $RootShare + $Path
New-smbshare -name $Path -path $LongPath -FullAccess Everyone -WhatIf
}
Get this error:
New-smbshare : The filename, directory name, or volume label syntax is incorrect.
At line:9 char:5
-
New-smbshare -name $Path -path $LongPath -FullAccess Everyone -WhatIf -
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~- CategoryInfo : NotSpecified: (MSFT_SMBShare:ROOT/Microsoft/Windows/SMB/MSFT_SMBShare) [New-SmbShare], CimException
- FullyQualifiedErrorId : Windows System Error 123,New-SmbShare
Going further, it looks like I need to use Get-WMI because I am connecting to a Hitachi HDI (Linux based NAS)
Get-WmiObject -Class Win32_Share -ComputerName “prdjcaveuchdi02.prod-am.ameritrade.com”
$share = Get-WmiObject Win32_Share -List -ComputerName “prdjcaveuchdi02”
$share.create(“\prdjcaveuchdi02.prod-am.ameritrade.com\c$\marcus”, “marcus”, 0)
I then get the error below. (note - that this did work remotely when connecting to another Windows system. Hitachi fails)
Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
At line:1 char:1
- Get-WmiObject -Class Win32_Share -ComputerName "prdjcaveuchdi02.prod-am.ameritra …
-
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], COMException + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
I am concerned the this HItachi system won’t allow or support RPC.
Any help is greatly appreciated.
thank you
Jay