Closed admiralmorgan closed 8 years ago
It seems that with the modification noted as: #Corrected issue with double quotes breaking share properties in 8.3.1 - 7/6/2015
Some issue are now present
What version of cDOT are you using? These were tested in 8.2.x and 8.3.x. If you are using a version prior to 8.2.x, you might get unexpected results. The scripts work fine for me in my environment.
The line it's complaining about is this one:
$mycmd = $mycmd + " -SymlinkProperties ""$mySymlinkProp"""
From my broken Italian, it sounds like it choked on the "-" operator and that it expected something else. Can you double check the script to ensure you are using the latest version? Could be an issue in the formatting.
https://github.com/DatacenterDudes/cDOT-CIFS-share-backup-restore/blob/master/restoreSharesAcls.ps1
When you run "help Add-NcCifsShare" from PowerShell, do you get the SymlinkProperties option listed?
Example:
PS C:> help Add-NcCifsShare
NAME Add-NcCifsShare
SYNOPSIS Creates a new CIFS share rooted at the specified path.
SYNTAX
Add-NcCifsShare [-Name]
Thanks for the response!
I'm using Ontap 8.3p2
Here is the error in english and the output you requested:
PS C:\Script> .\restoreSharesAcls.ps1 -server 172.16.3.222 -user admin -password netapp123 -vserver svm_ITMIJENE06 -shareFile C:\share.xml -aclFile C:\acl.xml -spit more You must provide a value expression on the right-hand side of the '-' operator. At C:\Script\restoreSharesAcls.ps1:114 char:30
PS C:\Script> help Add-NcCifsShare
NAME Add-NcCifsShare
SYNOPSIS Creates a new CIFS share rooted at the specified path.
SYNTAX
Add-NcCifsShare [-Name]
DESCRIPTION Creates a new CIFS share rooted at the specified path.
RELATED LINKS Set-NcCifsShare Remove-NcCifsShare Get-NcCifsShare
REMARKS To see the examples, type: "get-help Add-NcCifsShare -examples". For more information, type: "get-help Add-NcCifsShare -detailed". For technical information, type: "get-help Add-NcCifsShare -full".
I've read the older version of the script and I changed back the line 97:
$mycmd = $mycmd + " -ShareProperties $myShareProp
Now it looks
$mycmd = $mycmd + " -ShareProperties ""$myShareProp"""
But I read this error now:
PS C:\Script> Add-NcCifsShare -VserverContext svm_ITMIJENE06 -Name "vol_itmijefs_test" -Path "/vol_itmijefs_test" -Share Properties "browsable,changenotify,oplocks" -SymlinkProperties "enable" -OfflineFilesMode "manual" Add-NcCifsShare : Invalid value specified for "share-properties" element within "cifs-share-create": "browsable,changen otify,oplocks". At line:1 char:16
I don't see any output in the email you sent.
Did changing the line do anything for you?
On Mon, Aug 17, 2015 at 10:34 AM, admiralmorgan notifications@github.com wrote:
Thanks for the response!
I'm using Ontap 8.3p2
Here is the error in english and the output you requested:
I've read the older version of the script and I changed back the line 97:
— Reply to this email directly or view it on GitHub https://github.com/DatacenterDudes/cDOT-CIFS-share-backup-restore/issues/5#issuecomment-131842397 .
Thanks for the response!
I'm using Ontap 8.3p2
Here is the error in english and the output you requested:
PS C:\Script> .\restoreSharesAcls.ps1 -server 172.16.3.222 -user admin -password netapp123 -vserver svm_ITMIJENE06 -shareFile C:\share.xml -aclFile C:\acl.xml -spit more You must provide a value expression on the right-hand side of the '-' operator. At C:\Script\restoreSharesAcls.ps1:114 char:30
$mycmd = $mycmd + " - <<<< SymlinkProperties ""$mySymlinkProp"""
CategoryInfo : ParserError: (:) [], ParseException
FullyQualifiedErrorId : ExpectedValueExpression
PS C:\Script> help Add-NcCifsShare
NAME Add-NcCifsShare
SYNOPSIS Creates a new CIFS share rooted at the specified path.
SYNTAX Add-NcCifsShare [-Name] [-Path] [-ShareProperties ] [-SymlinkProperties ] [-F ileUmask ] [-DirUmask ] [-Comment ] [-OfflineFilesMode ] [-AttributeCacheTtl ] [-VscanProfile ] [-MaxConnectionsPerShare ] [-ForceGroupForCreate ] [-DisablePathValidation ] [-VserverContext ] [-Controller ] [-ZapiRetryCount ] []
DESCRIPTION Creates a new CIFS share rooted at the specified path.
RELATED LINKS Set-NcCifsShare Remove-NcCifsShare Get-NcCifsShare
REMARKS To see the examples, type: "get-help Add-NcCifsShare -examples". For more information, type: "get-help Add-NcCifsShare -detailed". For technical information, type: "get-help Add-NcCifsShare -full".
I've read the older version of the script and I changed back the line 97:
$mycmd = $mycmd + " -ShareProperties $myShareProp
Now it looks
$mycmd = $mycmd + " -ShareProperties ""$myShareProp"""
But I read this error now:
PS C:\Script> Add-NcCifsShare -VserverContext svm_ITMIJENE06 -Name "vol_itmijefs_test" -Path "/vol_itmijefs_test" -Share Properties "browsable,changenotify,oplocks" -SymlinkProperties "enable" -OfflineFilesMode "manual" Add-NcCifsShare : Invalid value specified for "share-properties" element within "cifs-share-create": "browsable,changen otify,oplocks". At line:1 char:16
Add-NcCifsShare <<<< -VserverContext svm_ITMIJENE06 -Name "vol_itmijefs_test" -Path "/vol_itmijefs_test" -ShareProperties "browsable,changenotify,oplocks" -SymlinkProperties "enable" -OfflineFilesMode "manual"
CategoryInfo : InvalidOperation: (172.16.3.222:NcController) [Add-NcCifsShare], EINVALIDINPUTERROR
FullyQualifiedErrorId : ApiException,DataONTAP.C.PowerShell.SDK.Cmdlets.Cifs.AddNcCifsShare
Nevermind. GMail cut the output out. I see it on Github now.
The 2nd error you got was what the change was intended to fix. I'd recommend changing that back.
As for the Symlink issue, do you have the latest version of the ONTAP powershell toolkit module installed? Be sure to use the latest available:
Also, be sure there isn't a space between - and SymlinkProperties.
Can you paste the contents of the script you are using?
I'm using Ontap powershell toolkit 3.2.1
Here is the script I have downloaded (before any modification):
#
#
#
# Param([parameter(Mandatory = $true)] [alias("s")] $server, [parameter(Mandatory = $true)] [alias("u")] $user, [parameter(Mandatory = $true)] [alias("p")] $password, [parameter(Mandatory = $true)] [alias("v")] $vserver, [parameter(Mandatory = $true)] [alias("sf")] $shareFile, [parameter(Mandatory = $true)] [alias("af")] $aclFile, [parameter(Mandatory = $true)] [alias("sp")] [Validateset("none","less","more")]$spit, [alias("po")] [Validateset("false","true")] $printOnly = "false")
Import-Module DataONTAP
$passwd = ConvertTo-SecureString $password -AsPlainText -Force $cred = New-Object -typename System.Management.Automation.PSCredential -ArgumentList $user, $passwd $nctlr = Connect-NcController $server -Credential $cred $nodesinfo = @{}
$new_shares = Import-Clixml -Path $shareFile
if ($spit -ne "none") { echo "=====================================================================================" echo "SHARES" echo "====================================================================================="
if ($spit -eq "less")
{
$new_shares
}
elseif ($spit -eq "more")
{
$new_shares | Format-List
}
} echo "====================================================================================="
$new_shares | foreach { $mycmd = "Add-NcCifsShare -VserverContext $vserver"
$myName = $_.ShareName
if (($myName -eq "admin$") -or ($myName -eq "c$") -or ($myName -eq "ipc$"))
{
$mycmd = "Skip adding: " + $myName
if ($spit -ne "none")
{
$mycmd
echo "--------------------"
}
return
}
if (($myName -ne $null) -and ($myName -ne ""))
{
$mycmd = $mycmd + " -Name ""$myName"""
}
$myPath = $_.Path
if (($myPath -ne $null) -and ($myPath -ne ""))
{
$mycmd = $mycmd + " -Path ""$myPath"""
}
$myComment = $_.Comment
if (($myComment -ne $null) -and ($myComment -ne ""))
{
$mycmd = $mycmd + " -Comment ""$myComment"""
}
$myShareProperties = $_.ShareProperties
if (($myShareProperties -ne $null) -and ($myShareProperties -ne ""))
{
$myShareProp = ""
foreach ($prop in $myShareProperties) {
if ($myShareProp -eq "")
{
$myShareProp = $prop
}
else
{
$myShareProp = $myShareProp , $prop -join ','
}
}
$mycmd = $mycmd + " -ShareProperties $myShareProp
}
$mySymlinkProperties = $_.SymlinkProperties
if (($mySymlinkProperties -ne $null) -and ($mySymlinkProperties -ne ""))
{
$mySymlinkProp = ""
foreach ($prop in $mySymlinkProperties) {
if ($mySymlinkProp -eq "")
{
$mySymlinkProp = $prop
}
else
{
$mySymlinkProp = $mySymlinkProp , $prop -join ','
}
}
$mycmd = $mycmd + " -SymlinkProperties ""$mySymlinkProp"""
}
$myFileUmask = $_.FileUmask
if (($myFileUmask -ne $null) -and ($myFileUmask -ne ""))
{
$mycmd = $mycmd + " -FileUmask ""$myFileUmask"""
}
$myDirUmask = $_.DirUmask
if (($myDirUmask -ne $null) -and ($myDirUmask -ne ""))
{
$mycmd = $mycmd + " -DirUmask ""$myDirUmask"""
}
$myOfflineFilesMode = $_.OfflineFilesMode
if (($myOfflineFilesMode -ne $null) -and ($myOfflineFilesMode -ne ""))
{
$mycmd = $mycmd + " -OfflineFilesMode ""$myOfflineFilesMode"""
}
$myAttributeCacheTtl = $_.AttributeCacheTtl
if (($myAttributeCacheTtl -ne $null) -and ($myAttributeCacheTtl -ne ""))
{
$mycmd = $mycmd + " -AttributeCacheTtl ""$myAttributeCacheTtl"""
}
$myVscanProfile = $_.VscanProfile
if (($myVscanProfile -ne $null) -and ($myVscanProfile -ne ""))
{
$mycmd = $mycmd + " -VscanProfile ""$myVscanProfile"""
}
if ($spit -ne "none")
{
$mycmd
echo "--------------------"
}
if ($printOnly -eq "false")
{
Invoke-Expression $mycmd
Remove-NcCifsShareAcl -VserverContext $vserver -Share $myName -UserOrGroup Everyone
}
}
$new_acls = Import-Clixml -Path $aclFile
if ($spit -ne "none") { echo "=====================================================================================" echo "ACLS" echo "====================================================================================="
if ($spit -eq "less")
{
$new_acls
}
elseif ($spit -eq "more")
{
$new_acls | Format-List
}
echo "====================================================================================="
}
$new_acls | foreach { $mycmd = "Add-NcCifsShareAcl -VserverContext $vserver"
$myShare = $_.Share
if (($myShare -eq "admin$") -or ($myShare -eq "ipc$") -or ($myShare -eq "c$"))
{
$myCmd = "Skip adding Acls for " + $myShare
if ($spit -ne "none")
{
$mycmd
echo "--------------------"
}
return
}
if (($myShare -ne $null) -and ($myShare -ne ""))
{
$mycmd = $mycmd + " -Share ""$myShare"""
}
$myUserGroupType = $_.UserGroupType
if (($myUserGroupType -ne $null) -and ($myUserGroupType -ne ""))
{
$mycmd = $mycmd + " -UserGroupType ""$myUserGroupType"""
}
$myUserOrGroup = $_.UserOrGroup
if (($myUserOrGroup -ne $null) -and ($myUserOrGroup -ne ""))
{
$mycmd = $mycmd + " -UserOrGroup ""$myUserOrGroup"""
}
$myPermission = $_.Permission
if (($myPermission -ne $null) -and ($myPermission -ne ""))
{
$mycmd = $mycmd + " -Permission ""$myPermission"""
}
if ($spit -ne "none")
{
$mycmd
echo "--------------------"
}
if ($printOnly -eq "false")
{
Invoke-Expression $mycmd
}
}
I've checked for any sintax error, but I may have missed something...
Add a double quote to your script here:
$mycmd = $mycmd + " -ShareProperties $myShareProp"
Then try it again.
Note that's a trailing " at the end. There wasn't one there before.
I'll make a change to the existing script.
It works like a charm!!!!
Thank you so mutch for the wonderfull work!! If you are ever near Milan (or at netapp insight emea) get in touch for a drink!!
I will be in Berlin this year for sure. Doing two sessions. :)
Come find me!
And thanks for pointing out the mistake!
Hi justin,
I've jsut put to work your script but I have an issue with the power shell, I've restoring a very big environment, with a lot of shares and ACL.
During the configuration of the shares I receive some errors, linked to an issue with the Key Sensitive configuration of the shares with CDOT. We have fixed it by manually creating the missing shares.
But the real issue is with the ACL. After a lot of ACL configuration the power shell begin to send out this errrors:
Add-NcCifsShareAcl -VserverContext ITMIJESV103 -Share "WS_ROAMING_PROFILES$" -UserGroupType "windows" -UserOrGroup "BUI
LTIN\Administrators" -Permission "full_control"
Add-NcCifsShareAcl : Could not find file 'C:\Users\silvestrir\AppData\Local\Temp\2\chnzhkaq.dll'.
At line:1 char:19
oup "BUILTIN\Administrators" -Permission "full_control"
+ CategoryInfo : InvalidOperation: (172.16.3.225:NcController)
[Add-NcCifsShareAcl], FileNotFoundExceptio
n
+ FullyQualifiedErrorId :
ApiException,DataONTAP.C.PowerShell.SDK.Cmdlets.Cifs.AddNcCifsShareAcl
Add-NcCifsShareAcl -VserverContext ITMIJESV103 -Share "WS_ROAMING_PROFILES$" -UserGroupType "windows" -UserOrGroup "eve
ryone" -Permission "change"
My best guess is that after a LOT of commands the power shell has some issues... Has this happened to anyone else? Is there a way to resolve the issue?
Thanks for the support!!
Stefano
On Mon, Aug 17, 2015 at 5:07 PM, Justin Parisi notifications@github.com wrote:
And thanks for pointing out the mistake!
— Reply to this email directly or view it on GitHub https://github.com/DatacenterDudes/cDOT-CIFS-share-backup-restore/issues/5#issuecomment-131856169 .
Hi justin,
I've jsut put to work your script but I have an issue with the power shell, I've restoring a very big environment, with a lot of shares and ACL.
During the configuration of the shares I receive some errors, linked to an issue with the Key Sensitive configuration of the shares with CDOT. We have fixed it by manually creating the missing shares.
But the real issue is with the ACL. After a lot of ACL configuration the power shell begin to send out this errrors:
Add-NcCifsShareAcl -VserverContext ITMIJESV103 -Share "WS_ROAMING_PROFILES$" -UserGroupType "windows" -UserOrGroup "BUI
LTIN\Administrators" -Permission "full_control"
Add-NcCifsShareAcl : Could not find file 'C:\Users\silvestrir\AppData\Local\Temp\2\chnzhkaq.dll'.
At line:1 char:19
oup "BUILTIN\Administrators" -Permission "full_control"
+ CategoryInfo : InvalidOperation: (172.16.3.225:NcController) [Add-NcCifsShareAcl], FileNotFoundExceptio
n
+ FullyQualifiedErrorId : ApiException,DataONTAP.C.PowerShell.SDK.Cmdlets.Cifs.AddNcCifsShareAcl
Add-NcCifsShareAcl -VserverContext ITMIJESV103 -Share "WS_ROAMING_PROFILES$" -UserGroupType "windows" -UserOrGroup "eve
ryone" -Permission "change"
My best guess is that after a LOT of commands the power shell has some issues... Has this happened to anyone else? Is there a way to resolve the issue?
Thanks for the support!!
Does it work if you run Add-NcCifsShareAcl manually in PowerShell for one of the shares?
I don't think the size of the environment would be an issue here.
The error looks like it's choking on a missing dll. But I have no idea what that dll is. Google doesn't find anything called chnzhkaq.dll and it's not on my server running Win2k12. The folder it's looking in is a user named silvestrir. Is that you? Is that the user that's logged in?
Did you try a different server?
DLL issues usually are client issues. If we knew what that dll was from, we could figure out why it's broken. But I have no idea what that one is. This is unlikely an issue with the script itself.
On Mon, Aug 24, 2015 at 6:37 AM, admiralmorgan notifications@github.com wrote:
Hi justin,
I've jsut put to work your script but I have an issue with the power shell, I've restoring a very big environment, with a lot of shares and ACL.
During the configuration of the shares I receive some errors, linked to an issue with the Key Sensitive configuration of the shares with CDOT. We have fixed it by manually creating the missing shares.
But the real issue is with the ACL. After a lot of ACL configuration the power shell begin to send out this errrors:
Add-NcCifsShareAcl -VserverContext ITMIJESV103 -Share "WS_ROAMING_PROFILES$" -UserGroupType "windows" -UserOrGroup "BUI
LTIN\Administrators" -Permission "full_control"
Add-NcCifsShareAcl : Could not find file 'C:\Users\silvestrir\AppData\Local\Temp\2\chnzhkaq.dll'.
At line:1 char:19
- Add-NcCifsShareAcl <<<< -VserverContext ITMIJESV103 -Share "WS_ROAMING_PROFILES$" -UserGroupType "windows" -UserOrGr
oup "BUILTIN\Administrators" -Permission "full_control"
- CategoryInfo : InvalidOperation: (172.16.3.225:NcController) [Add-NcCifsShareAcl], FileNotFoundExceptio
n
- FullyQualifiedErrorId : ApiException,DataONTAP.C.PowerShell.SDK.Cmdlets.Cifs.AddNcCifsShareAcl
Add-NcCifsShareAcl -VserverContext ITMIJESV103 -Share "WS_ROAMING_PROFILES$" -UserGroupType "windows" -UserOrGroup "eve
ryone" -Permission "change"
My best guess is that after a LOT of commands the power shell has some issues... Has this happened to anyone else? Is there a way to resolve the issue?
Thanks for the support!!
— Reply to this email directly or view it on GitHub https://github.com/DatacenterDudes/cDOT-CIFS-share-backup-restore/issues/5#issuecomment-134141493 .
Hi there, I get this error:
PS C:> .\restoreSharesAcls.ps1 Specificare un'espressione di valore sul lato destro dell'operatore '-'. In C:\restoreSharesAcls.ps1:114 car:30
Can you please set me on the right course to find a solution?
Best regards, Stefano