Skip to content

Commit

Permalink
Samples updated
Browse files Browse the repository at this point in the history
  • Loading branch information
SNikalaichyk committed May 4, 2016
1 parent c3fcd28 commit 80c7c78
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion Examples/Sample_cNtfsPermissionEntry.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Configuration Sample_cNtfsPermissionEntry
[Parameter(Mandatory = $false)]
[ValidateNotNullOrEmpty()]
[String]
$Path = (Join-Path -Path ([System.IO.Path]::GetTempPath()) -ChildPath ([System.Guid]::NewGuid().Guid))
$Path = (Join-Path -Path ([System.IO.Path]::GetTempPath()) -ChildPath ([Guid]::NewGuid().Guid))
)

Import-DscResource -ModuleName cNtfsAccessControl
Expand Down Expand Up @@ -52,18 +52,24 @@ Configuration Sample_cNtfsPermissionEntry
AccessControlInformation = @(
cNtfsAccessControlInformation
{
AccessControlType = 'Allow'
FileSystemRights = 'Modify'
Inheritance = 'ThisFolderOnly'
NoPropagateInherit = $false
}
cNtfsAccessControlInformation
{
AccessControlType = 'Allow'
FileSystemRights = 'ReadAndExecute'
Inheritance = 'ThisFolderSubfoldersAndFiles'
NoPropagateInherit = $false
}
cNtfsAccessControlInformation
{
AccessControlType = 'Allow'
FileSystemRights = 'AppendData', 'CreateFiles'
Inheritance = 'SubfoldersAndFilesOnly'
NoPropagateInherit = $false
}
)
DependsOn = '[File]TestDirectory'
Expand Down
2 changes: 1 addition & 1 deletion Examples/Sample_cNtfsPermissionsInheritance.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Configuration Sample_cNtfsPermissionsInheritance
[Parameter(Mandatory = $false)]
[ValidateNotNullOrEmpty()]
[String]
$Path = (Join-Path -Path ([System.IO.Path]::GetTempPath()) -ChildPath ([System.Guid]::NewGuid().Guid))
$Path = (Join-Path -Path ([System.IO.Path]::GetTempPath()) -ChildPath ([Guid]::NewGuid().Guid))
)

Import-DscResource -ModuleName cNtfsAccessControl
Expand Down

1 comment on commit 80c7c78

@yvesgermain
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you give an example of using CntfsPermissions with Invoke-dscresource?
PS C:> invoke-dscresource -ModuleName cNtfsAccessControl -Name cNtfsPermissionEntry -Method get -Property @{Ensure = 'Present' ;Principal = "server\user"; Path= 'D:\InetPub' ; AccessControlInformation = @(cNtfsAccessControlInformation { AccessControlType = 'Allow';FileSystemRights = 'Modify';Inheritance = 'SubfoldersAndFilesOnly';NoPropagateInherit = $false})}

I keep getting an error message:
cNtfsAccessControlInformation : Le terme «cNtfsAccessControlInformation» n'est pas reconnu comme nom d'applet de commande, fonction, fichier de script ou programme exécutable. Vérifiez l'orthographe du nom, ou si un chemin d'accès existe, vérifiez que le chemin d'accès est correct et réessayez.
Au caractère Ligne:1 : 207

  • ... ; AccessControlInformation = @(cNtfsAccessControlInformation { Acces ...
  •                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ObjectNotFound: (cNtfsAccessControlInformation:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

invoke-dscresource : Échec de la sérialisation des propriétés dans CimInstance.
Au caractère Ligne:1 : 1

  • invoke-dscresource -ModuleName cNtfsAccessControl -Name cNtfsPermissi ...
  •   + CategoryInfo          : NotSpecified: (:) [Invoke-DscResource], SerializationException
      + FullyQualifiedErrorId : System.Runtime.Serialization.SerializationException,Microsoft.PowerShell.DesiredStateConfiguration.Commands.InvokeDscResourceMethodCommand
    
    

PS C:> $PSVersionTable

Name Value


PSVersion 5.1.14409.1012
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14409.1012
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Please sign in to comment.