CamFlyerCH / FileShareUtils

Powershell module to help with all file server tasks without using WMI
MIT License
12 stars 3 forks source link

Issue with New-NetShare related to WMI #12

Open daoudi93 opened 8 months ago

daoudi93 commented 8 months ago

trying to create share on NetApp CVO (cloud volumes) it is returning WMI errors, the current logged in account is built-in Administrator on the SVM

PS C:\Windows\system32> New-NetShare -Name "testscript" -Path "/EUWDRVolume01_share/G_Drive/testfromCVO" -Server 10.82.72.8 Error during NetShareAdd: The parameter is incorrect (Win32 ErrorCode 87 - 0x00000057) At C:\Program Files\WindowsPowerShell\Modules\FileShareUtils\1.0.24\FileShareUtils.psm1:1131 char:13

CamFlyerCH commented 8 months ago

Is there a share already ? Could you please list this share with Get-NetFileShares -Server 10.82.72.8 ? I think in your path parameter is incorrect. It should start with C:\ or another drive letter.

daoudi93 commented 8 months ago

Hi

yes SMB Shares are showing when trying to retrieve them PS C:\Users\1480> Get-NetFileShares -Server 10.82.72.8 |Select name, path

Name Path


EUWDRVolume01_share C:\ BISAM Team C:\EUWVolume_DRShare\PAPHOM02-ABT_D_Drive\BISAM Team AF_FA_ExternalAudit C:\EUWVolume_DRShare\PAPHOM02-ABT_D_Drive\External Audit

  1. Data for KPMG C:\EUWVolume_DRShare\PAPHOM02-ABT_D_Drive\External Audit\2017\1. Council Audit Work... DMS_General Services C:\EUWVolume_DRShare\PAPHOM02-ABT_D_Drive\General Services GS_Contracts_MasterSheet C:\EUWVolume_DRShare\PAPHOM02-ABT_D_Drive\General Services\Facilities Management\Se... GS_FM_MDS&IT_Contracts C:\EUWVolume_DRShare\PAPHOM02-ABT_D_Drive\General Services\Facilities Management\Se... GS_MubadalaAuditing_2023_WSP C:\EUWVolume_DRShare\PAPHOM02-ABT_D_Drive\General Services\Hard Services\71. MUBADA... GS_Procurement_MDS C:\EUWVolume_DRShare\PAPHOM02-ABT_D_Drive\General Services\Procurement\Market Data ... GS_SoftServices_EmployeeServices C:\EUWVolume_DRShare\PAPHOM02-ABT_D_Drive\General Services\Soft Services\Employee S... Hotels C:\EUWVolume_DRShare\PAPHOM02-ABT_D_Drive\General Services\Soft Services\Hotels SoftServices_Hotel_Bills_Final C:\EUWVolume_DRShare\PAPHOM02-ABT_D_Drive\General Services\Soft Services\Hotels\Res... DMS_Human Resources C:\EUWVolume_DRShare\PAPHOM02-ABT_D_Drive\Human Resources DMS_HR_ER_JobDescriptions C:\EUWVolume_DRShare\PAPHOM02-ABT_D_Drive\Human Resources\Employee Relations!! Job... ManPowerPlanning-2023 C:\EUWVolume_DRShare\PAPHOM02-ABT_D_Drive\Human Resources\International Recruitment... PDF-Chart C:\EUWVolume_DRShare\PAPHOM02-ABT_D_Drive\Human Resources\Org. Chart\Org. Chart 202... MA-HR C:\EUWVolume_DRShare\PAPHOM02-ABT_D_Drive\MA-HR DMS_Management Accounts C:\EUWVolume_DRShare\PAPHOM02-ABT_D_Drive\Management Accounts Secnet C:\EUWVolume_DRShare\PAPHOM02-ABT_D_Drive\Secnet Test C:\EUWVolume_DRShare\PAPHOM02-ABT_D_Drive\Test PrivateEquity-New C:\EUWVolume_DRShare\PAPHOM02-ABT_E_Drive\PrivateEquity AFS_PerformanceCalculations_B... C:\EUWVolume_DRShare\PAPHOM02-ABT_F_Drive\AccountingFinancial\AFS Performance and R... AFS-Data C:\EUWVolume_DRShare\PAPHOM02-ABT_F_Drive\AccountingFinancial\AFS-Data RiskManagement-Department C:\EUWVolume_DRShare\PAPHOM02-ABT_F_Drive\RiskManagement-Department RM_AuditedFinancials C:\EUWVolume_DRShare\PAPHOM02-ABT_F_Drive\RiskManagement-Department\RM_AuditedFinan...

my issue is only when trying to create a new file shares, just to let you know, the storage is NetApp Cloud Volume

CamFlyerCH commented 8 months ago

Thanks. I am shure now, that your fault is the path you use in your command. Try it like this:

New-NetShare -Name "testscript" -Path "C:\EUWDRVolume01_share\G_Drive\testfromCVO" -Server 10.82.72.8

You have to use C:\ and backslashes ( \ ) Check also the backup script I added that prepares cemmands to (re-)create shares as they where during backup. It is easy to just change the share-name and create a second share on the same path. Backup-Shares.ps1

daoudi93 commented 8 months ago

thanks alot for your quick reply, actually when I was trying with C:\ path i'm getting an error.

New-NetShare -Name "testscript" -Path "C:\EUWDRVolume01_share\G_Drive\testfromCVO" -Server 10.82.72.8 Error during NetShareAdd: The system cannot find the path specified (Win32 ErrorCode 3 - 0x00000003) At C:\Program Files\WindowsPowerShell\Modules\FileShareUtils\1.0.24\FileShareUtils.psm1:1131 char:13

the backend storage is NetApp Cloud Volume and actually the path on the system has to be in the format /EUWDRVolume01_share/G_Drive/testfromCVO, and the error i'm getting is Incorrect parameters,

New-NetShare -Name "testscript" -Path "/EUWDRVolume01_share/G_Drive/testfromCVO" -Server 10.82.72.8 Error during NetShareAdd: The parameter is incorrect (Win32 ErrorCode 87 - 0x00000057) At C:\Program Files\WindowsPowerShell\Modules\FileShareUtils\1.0.24\FileShareUtils.psm1:1131 char:13

when using Windows based shares it is working fine on other windows file servers, the problem I'm facing is just only with NetApp storage