Comments (16)
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
from cdot-cifs-share-backup-restore.
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] [-Path] [-ShareProperties
<String[]>] [-*SymlinkProperties *<String[]>]
[-FileUmask ] [-DirUmask ] [-Comment ]
[-OfflineFilesMode ] [-AttributeCacheTtl
] [-VscanProfile ] [-MaxConnectionsPerShare ]
[-ForceGroupForCreate ]
[-DisablePathValidation] [-VserverContext ] [-Controller
<NcController[]>] [-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".
For online help, type: "get-help Add-NcCifsShare -online"
Maybe right click the script in Windows and open up in the PowerShell
editor to see if you have any syntax issues from when you copied/pasted it?
On Mon, Aug 17, 2015 at 10:05 AM, admiralmorgan [email protected]
wrote:
It seems that with the modification noted as: #Corrected issue with double
quotes breaking share properties in 8.3.1 - 7/6/2015Some issue are now present
—
Reply to this email directly or view it on GitHub
#5 (comment)
.
from cdot-cifs-share-backup-restore.
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 <String[]>] [-SymlinkProperties <String[]>] [-F
ileUmask ] [-DirUmask ] [-Comment ] [-OfflineFilesMode ] [-AttributeCacheTtl ]
[-VscanProfile ] [-MaxConnectionsPerShare ] [-ForceGroupForCreate ] [-DisablePathValidation
] [-VserverContext ] [-Controller <NcController[]>] [-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
from cdot-cifs-share-backup-restore.
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 [email protected]
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
#5 (comment)
.
from cdot-cifs-share-backup-restore.
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
from cdot-cifs-share-backup-restore.
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:
from cdot-cifs-share-backup-restore.
Also, be sure there isn't a space between - and SymlinkProperties.
Can you paste the contents of the script you are using?
from cdot-cifs-share-backup-restore.
I'm using Ontap powershell toolkit 3.2.1
Here is the script I have downloaded (before any modification):
Usage:
Run as: .\restoreSharesAcls.ps1 -server <mgmt_ip> -user <mgmt_user> -password <mgmt_user_password> -vserver -shareFile -aclFile -spit <none,less,more depending on info to print>
Example
1. If you want to save create back shares from xml file C:\share.xml and acls from xml file C:\acls.xml on vserver vs2, with less information displayed on the screen
Run as: .\restoreSharesAcls.ps1 -server 10.53.33.59 -user admin -password netapp1! -vserver vs2 -shareFile C:\share.xml -aclFile C:\acl.xml -spit less
2. If you only want to print the commands and not actually create the shares, use -printOnly
Run as: .\restoreSharesAcls.ps1 -server 10.53.33.59 -user admin -password netapp1! -vserver vs2 -shareFile C:\share.xml -aclFile C:\acl.xml -spit less -printOnly true
This has been tested with the latest 8.2.x and 8.3.x cDOT releases.
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")
You need to install the latest DataONTAP Powershell Toolkit. You can find it here: http://mysupport.netapp.com/NOW/download/tools/powershell_toolkit/
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 ','
}
#Corrected issue with double quotes breaking share properties in 8.3.1 - 7/6/2015
}
$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...
from cdot-cifs-share-backup-restore.
Add a double quote to your script here:
$mycmd = $mycmd + " -ShareProperties $myShareProp"
Then try it again.
from cdot-cifs-share-backup-restore.
Note that's a trailing " at the end. There wasn't one there before.
I'll make a change to the existing script.
from cdot-cifs-share-backup-restore.
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!!
from cdot-cifs-share-backup-restore.
I will be in Berlin this year for sure. Doing two sessions. :)
Come find me!
from cdot-cifs-share-backup-restore.
And thanks for pointing out the mistake!
from cdot-cifs-share-backup-restore.
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!!
Stefano
On Mon, Aug 17, 2015 at 5:07 PM, Justin Parisi [email protected]
wrote:
And thanks for pointing out the mistake!
—
Reply to this email directly or view it on GitHub
#5 (comment)
.
from cdot-cifs-share-backup-restore.
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!!
from cdot-cifs-share-backup-restore.
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 [email protected]
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 "BUILTIN\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" -UserOrGroup "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 "everyone" -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
#5 (comment)
.
from cdot-cifs-share-backup-restore.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cdot-cifs-share-backup-restore.