Share existing folders under a root share

Welcome Forums General PowerShell Q&A Share existing folders under a root share

This topic contains 2 replies, has 2 voices, and was last updated by

3 years, 6 months ago.

  • Author
  • #27962

    Points: 0
    Rank: Member


    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 = "\\\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 ""

    $share = Get-WmiObject Win32_Share -List -ComputerName "prdjcaveuchdi02"

    $share.create("\\\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 " ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + 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

  • #27977

    Points: 24
    Team Member
    Rank: Member

    Hi Jay,

    As you experienced the Hitachi HDI appliance does not support WMI (Windows Management Instrumentation) because it is Linux based and Hitachi has not implemented OMI (Open Management Instrumentation) from what I can tell after a little Google fuh.

    However Hitachi has exposes an XML based API via HTTP/HTTPS as you can read in below PDF to create a CIFSShare for example.

    I think the best approach would be to reach out to Hitachi to help you. I do not have access to Hitachi systems and I guess most of the people answering in these forums do not have access either.


  • #27985

    Points: 0
    Rank: Member

    Thanks Daniel. Good advice. I have reached out to Hitachi for assistance.


The topic ‘Share existing folders under a root share’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort