IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Scripts/Batch Discussion :

Permissions NTFS de répertoires [PowerShell]


Sujet :

Scripts/Batch

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éprouvé
    Homme Profil pro
    Ingénieur systèmes et réseaux
    Inscrit en
    Décembre 2006
    Messages
    1 080
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Seine Maritime (Haute Normandie)

    Informations professionnelles :
    Activité : Ingénieur systèmes et réseaux

    Informations forums :
    Inscription : Décembre 2006
    Messages : 1 080
    Par défaut Permissions NTFS de répertoires
    Bonjour,

    J'ai scripté en PowerShell, un script me permettant de paresser un répertoire et sous répertoire en m'affichant les utilisateurs/groupes avec les droits d'accès NTFS lié au répertoire dans un fichier Excel :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    # FONCTIONS #
    
    # Fenêtre de sélection dossier
    function Select-Folder($message='Select a folder', $path = 0) { 
    	$object = New-Object -comObject Shell.Application  
    	 
    	$folder = $object.BrowseForFolder(0, $message, 0, $path) 
    	if ($folder -ne $null) { 
    		$folder.self.Path 
    	} 
    }
    
    # MAIN #
    
    # Effacer page #
    clear
    
    # Création du fichier Excel avec les entêtes #
    $a = New-Object -comobject Excel.Application
    $a.Visible = $True
    $b = $a.Workbooks.Add()
    $d = $b.Worksheets.Item(1)
    $d.name = "Droits NTFS"
    $ligne=1
    $col=1
    $d.Cells.Item($ligne,$col)= "Fullname"
    $col++
    $d.Cells.Item($ligne,$col)= "Identity" 
    $col++
    $d.Cells.Item($ligne,$col)= "Rights" 
    $col++
    $d.Cells.Item($ligne,$col)= "IsInherited" 
    $Ligne++
    
    # Sélectionner un dossier de recherche #
    $RootPath = Select-Folder 
    
    # Pareser les répertoires et sous répertoires #
    $Folders = dir $RootPath -recurse | where {$_.psiscontainer -eq $true}
    foreach ($Folder in $Folders)
    {
    	$ACL = Get-Acl $Folder.Fullname
    	foreach($acl in $acl)
    	{
    		$path = $acl.path
    		$owner = $ACL.owner
    		$access = $acl.Access
    		foreach($access in $access)
    		{
    			$Col=1
    			$d.Cells.Item($ligne,$col)= $Folder.Fullname -replace "\r\n","" #répertoire#
    			$Col++
    			
    			$d.Cells.Item($ligne,$col)= $access.IdentityReference.Value -replace "\r\n","" #groupe#
    			$Col++
    			
    			$ObjRow = out-string -InputObject $access.FileSystemRights #Accès NTFS#
    			$d.Cells.Item($ligne,$col)= $ObjRow -replace "\r\n",""
    			$Col++
    
    			$ObjRow = out-string -InputObject $access.IsInherited #Héritage : Yes/no#
    			$d.Cells.Item($ligne,$col)= $ObjRow -replace "\r\n",""
    			$ligne++		
    		}
    	}
    }
    # Message box : fin de traitement#
    [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
    $oReturn=[System.Windows.Forms.Messagebox]::Show("Traitement termine")
    
    $Resize=$d.UsedRange
    $Resize.EntireColumn.AutoFilter()
    $Resize.EntireColumn.AutoFit()
    $b.SaveAs("D:\Bureau\NTFS.xlsx")
    $a.Quit()
    Dont voici le résultat :

    Nom : ScreenShot004.jpg
Affichages : 2432
Taille : 220,1 Ko

    Q1. Je ne sais pas pourquoi, mais mon paresseur de répertoire ne prend pas en compte le dossier parent et commence l'exploration au dossier enfant. Comment remédier à cela ?

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    $Folders = dir $RootPath -recurse | where {$_.psiscontainer -eq $true}
    foreach ($Folder in $Folders){
    ...
    }
    Q2. Comme vous pouvez le voir, dans la colonne "Rights", j'ai des numéros et je ne sais pas à quoi cela correspond.
    Y a t-il possibilité d'améliorer cela ?
    L'idéal serait d'avoir l'information la plus explicite possible : contrôle total, modification, Lecture, exécution, affichage du contenu du dossier, écriture, spéciales

    Merci d'avance pour votre aide.

  2. #2
    Rédacteur


    Profil pro
    Inscrit en
    Janvier 2003
    Messages
    7 171
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2003
    Messages : 7 171
    Billets dans le blog
    1
    Par défaut
    Salut,
    Q1: Ajoute le nom dans la collection :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    $Folders = @(dir $RootPath -recurse | where {$_.psiscontainer -eq $true})+(Get-Item $RootPath)
    Q2: Coder la transformation du champ ou utiliser Sddl :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     $Acl=get-acl c:\temp\
     ConvertFrom-SDDL $acl.Sddl|select -ExpandProperty access

  3. #3
    Membre éprouvé
    Homme Profil pro
    Ingénieur systèmes et réseaux
    Inscrit en
    Décembre 2006
    Messages
    1 080
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Seine Maritime (Haute Normandie)

    Informations professionnelles :
    Activité : Ingénieur systèmes et réseaux

    Informations forums :
    Inscription : Décembre 2006
    Messages : 1 080
    Par défaut
    Merci beaucoup pour ces éléments.

    Q1 : J'ai écris le code comme cela pour avoir le répertoire racine en 1er dans mon Excel :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $Folders = @(Get-Item $RootPath) + (dir $RootPath -recurse | where {$_.psiscontainer -eq $true})
    Q2. Merci pour cet article : http://blog.cjwdev.co.uk/2011/06/28/...emrights-enum/. Je comprend mieux maintenant.
    Mais le mieux est d'utilisé SDDL ?

    Je ne sais comment intégré cette élément de réponse dans mon script :

    J'ai copier/collé la class ConvertFrom-SDDL dans mon script.

    J'ai ensuite ajouté :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    $ACL = Get-Acl $Folder.Fullname
    ConvertFrom-SDDL $acl.Sddl|select -ExpandProperty access
    En sortie j'ai par exemple :

    InheritanceFlags : None
    IsInherited : True
    Rights : ReadData,ReadExtendedAttributes,ReadAttributes,ReadPermissions,Synchronize,ExecuteFile,Read,ReadAnd
    Execute
    AccessControlType : Allow
    IdentityReference : BUILTIN\Utilisateurs
    PropagationFlags : None
    J'aurai voulu récupérer les informations de "Rights" dans mon

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    	foreach($acl in $acl)
    	{
    		$path = $acl.path
    		$owner = $ACL.owner
    		$access = $acl.Access
    		foreach($access in $access)
    		{
    			$Col=1
    			$d.Cells.Item($ligne,$col)= $Folder.Fullname -replace "\r\n","" #répertoire#
    			$Col++
    			
    			$d.Cells.Item($ligne,$col)= $access.IdentityReference.Value -replace "\r\n","" #groupe#
    			$Col++
    			
    			$ObjRowFileSystemRights = out-string -InputObject $access.FileSystemRights #Accès NTFS#
    			$d.Cells.Item($ligne,$col)= $ObjRowFileSystemRights -replace "\r\n",""
    			$Col++
    
    			$ObjRowIsInherited = out-string -InputObject $access.IsInherited #Héritage : Yes/no#
    			$d.Cells.Item($ligne,$col)= $ObjRowIsInherited -replace "\r\n",""
    			$ligne++			
    		}
    	}
    Comment faire ?




    Pouvez-vous me donner plus d'explications ?

    Encore merci

  4. #4
    Membre éprouvé
    Homme Profil pro
    Ingénieur systèmes et réseaux
    Inscrit en
    Décembre 2006
    Messages
    1 080
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Seine Maritime (Haute Normandie)

    Informations professionnelles :
    Activité : Ingénieur systèmes et réseaux

    Informations forums :
    Inscription : Décembre 2006
    Messages : 1 080
    Par défaut
    J'ai réussi (en tout cas j'ai le résultat attendu) :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    # FONCTIONS #
    
    # Fenêtre de sélection dossier
    function Select-Folder($message='Select a folder', $path = 0) { 
    	$object = New-Object -comObject Shell.Application  
    	 
    	$folder = $object.BrowseForFolder(0, $message, 0, $path) 
    	if ($folder -ne $null) { 
    		$folder.self.Path 
    	} 
    }
    
    filter ConvertFrom-SDDL
    {
    	<#
    	.SYNOPSIS
    	 
    		Convert a raw security descriptor from SDDL form to a parsed security descriptor.
    	 
    		Author: Matthew Graeber (@mattifestation)
    	 
    	.DESCRIPTION
    	 
    		ConvertFrom-SDDL generates a parsed security descriptor based upon any string in raw security descriptor definition language (SDDL) form. ConvertFrom-SDDL will parse the SDDL regardless of the type of object the security descriptor represents.
    	 
    	.PARAMETER RawSDDL
    	 
    		Specifies the security descriptor in raw SDDL form.
    	 
    	.EXAMPLE
    	 
    		ConvertFrom-SDDL -RawSDDL 'D:PAI(A;;0xd01f01ff;;;SY)(A;;0xd01f01ff;;;BA)(A;;0x80120089;;;NS)'
    	 
    	.EXAMPLE
    	 
    		'O:BAG:SYD:(D;;0xf0007;;;AN)(D;;0xf0007;;;BG)(A;;0xf0005;;;SY)(A;;0x5;;;BA)', 'O:BAG:SYD:PAI(D;OICI;FA;;;BG)(A;OICI;FA;;;BA)(A;OICIIO;FA;;;CO)(A;OICI;FA;;;SY)' | ConvertFrom-SDDL
    	 
    	.INPUTS
    	 
    		System.String
    	 
    		ConvertFrom-SDDL accepts SDDL strings from the pipeline
    	 
    	.OUTPUTS
    	 
    		System.Management.Automation.PSObject
    	 
    	.LINK
    	 
    		http://www.exploit-monday.com
    	#>
     
    	Param (
    		[Parameter( Position = 0, Mandatory = $True, ValueFromPipeline = $True )]
    		[ValidateNotNullOrEmpty()]
    		[String[]]
    		$RawSDDL
    	)
     
    	Set-StrictMode -Version 2
     
    	# Get reference to sealed RawSecurityDescriptor class
    	$RawSecurityDescriptor = [Int].Assembly.GetTypes() | ? { $_.FullName -eq 'System.Security.AccessControl.RawSecurityDescriptor' }
     
    	# Create an instance of the RawSecurityDescriptor class based upon the provided raw SDDL
    	try
    	{
    		$Sddl = [Activator]::CreateInstance($RawSecurityDescriptor, [Object[]] @($RawSDDL))
    	}
    	catch [Management.Automation.MethodInvocationException]
    	{
    		throw $Error[0]
    	}
     
    	if ($Sddl.Group -eq $null)
    	{
    		$Group = $null
    	}
    	else
    	{
    		$SID = $Sddl.Group
    		$Group = $SID.Translate([Security.Principal.NTAccount]).Value
    	}
       
    	if ($Sddl.Owner -eq $null)
    	{
    		$Owner = $null
    	}
    	else
    	{
    		$SID = $Sddl.Owner
    		$Owner = $SID.Translate([Security.Principal.NTAccount]).Value
    	}
     
    	$ObjectProperties = @{
    		Group = $Group
    		Owner = $Owner
    	}
     
    	if ($Sddl.DiscretionaryAcl -eq $null)
    	{
    		$Dacl = $null
    	}
    	else
    	{
    		$DaclArray = New-Object PSObject[](0)
     
    		$ValueTable = @{}
     
    		$EnumValueStrings = [Enum]::GetNames([System.Security.AccessControl.CryptoKeyRights])
    		$CryptoEnumValues = $EnumValueStrings | % {
    				$EnumValue = [Security.AccessControl.CryptoKeyRights] $_
    				if (-not $ValueTable.ContainsKey($EnumValue.value__))
    				{
    					$EnumValue
    				}
    	   
    				$ValueTable[$EnumValue.value__] = 1
    			}
     
    		$EnumValueStrings = [Enum]::GetNames([System.Security.AccessControl.FileSystemRights])
    		$FileEnumValues = $EnumValueStrings | % {
    				$EnumValue = [Security.AccessControl.FileSystemRights] $_
    				if (-not $ValueTable.ContainsKey($EnumValue.value__))
    				{
    					$EnumValue
    				}
    	   
    				$ValueTable[$EnumValue.value__] = 1
    			}
     
    		$EnumValues = $CryptoEnumValues + $FileEnumValues
     
    		foreach ($DaclEntry in $Sddl.DiscretionaryAcl)
    		{
    			$SID = $DaclEntry.SecurityIdentifier
    			$Account = $SID.Translate([Security.Principal.NTAccount]).Value
     
    			$Values = New-Object String[](0)
     
    			# Resolve access mask
    			foreach ($Value in $EnumValues)
    			{
    				if (($DaclEntry.Accessmask -band $Value) -eq $Value)
    				{
    					$Values += $Value.ToString()
    				}
    			}
     
    			$Access = "$($Values -join ',')"
     
    			$DaclTable = @{
    				Rights = $Access
    				IdentityReference = $Account
    				IsInherited = $DaclEntry.IsInherited
    				InheritanceFlags = $DaclEntry.InheritanceFlags
    				PropagationFlags = $DaclEntry.PropagationFlags
    			}
     
    			if ($DaclEntry.AceType.ToString().Contains('Allowed'))
    			{
    				$DaclTable['AccessControlType'] = [Security.AccessControl.AccessControlType]::Allow
    			}
    			else
    			{
    				$DaclTable['AccessControlType'] = [Security.AccessControl.AccessControlType]::Deny
    			}
     
    			$DaclArray += New-Object PSObject -Property $DaclTable
    		}
     
    		$Dacl = $DaclArray
    	}
     
    	$ObjectProperties['Access'] = $Dacl
     
    	$SecurityDescriptor = New-Object PSObject -Property $ObjectProperties
     
    	Write-Output $SecurityDescriptor
    }
    
    # MAIN #
    
    # Effacer page #
    clear
    
    # Création du fichier Excel avec les entêtes #
    $a = New-Object -comobject Excel.Application
    $a.Visible = $True
    $b = $a.Workbooks.Add()
    $d = $b.Worksheets.Item(1)
    $d.name = "Droits NTFS"
    $ligne=1
    $col=1
    $d.Cells.Item($ligne,$col)= "Fullname"
    $col++
    $d.Cells.Item($ligne,$col)= "Identity" 
    $col++
    $d.Cells.Item($ligne,$col)= "Rights" 
    $col++
    $d.Cells.Item($ligne,$col)= "IsInherited" 
    $Ligne++
    
    # Sélectionner un dossier de recherche #
    $RootPath = Select-Folder 
    
    # Paresser les répertoires et sous répertoires #
    $Folders = @(Get-Item $RootPath) + (dir $RootPath -recurse | where {$_.psiscontainer -eq $true})
    
    foreach ($Folder in $Folders)
    {
    	$ACL = Get-Acl $Folder.Fullname
    	$access = ConvertFrom-SDDL $acl.Sddl|select -ExpandProperty access
    	foreach($acl in $acl)
    	{
    		foreach($access in $access)
    		{
    			$Col=1
    			$d.Cells.Item($ligne,$col)= $Folder.Fullname -replace "\r\n","" #répertoire#
    			$Col++
    			
    			$d.Cells.Item($ligne,$col)= $access.IdentityReference -replace "\r\n","" #groupe#
    			$Col++
    			
    			$ObjRowFileSystemRights = out-string -InputObject $access.Rights #Accès NTFS#
    			$d.Cells.Item($ligne,$col)= $ObjRowFileSystemRights -replace "\r\n",""
    			$Col++
    
    			$ObjRowIsInherited = out-string -InputObject $access.IsInherited #Héritage : Yes/no#
    			$d.Cells.Item($ligne,$col)= $ObjRowIsInherited -replace "\r\n",""
    			$ligne++			
    		}
    	}
    }
    # Message box : fin de traitement#
    [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
    $oReturn=[System.Windows.Forms.Messagebox]::Show("Traitement termine")
    
    $Resize=$d.UsedRange
    $Resize.EntireColumn.AutoFilter()
    $Resize.EntireColumn.AutoFit()
    $b.SaveAs("D:\Bureau\NTFS.xlsx")
    $a.Quit()
    Vous en pensez quoi ?

  5. #5
    Rédacteur


    Profil pro
    Inscrit en
    Janvier 2003
    Messages
    7 171
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2003
    Messages : 7 171
    Billets dans le blog
    1
    Par défaut
    Citation Envoyé par arnaudperfect Voir le message
    J'ai réussi (en tout cas j'ai le résultat attendu)
    C'est le principal.
    Fallait juste prendre le temps d'analyser l'objet renvoyé par la fonction...
    Citation Envoyé par arnaudperfect Voir le message
    Vous en pensez quoi ?
    Rien de particulier

  6. #6
    Membre éprouvé
    Homme Profil pro
    Ingénieur systèmes et réseaux
    Inscrit en
    Décembre 2006
    Messages
    1 080
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Seine Maritime (Haute Normandie)

    Informations professionnelles :
    Activité : Ingénieur systèmes et réseaux

    Informations forums :
    Inscription : Décembre 2006
    Messages : 1 080
    Par défaut
    Je viens de testé mon script sur un serveur, et j'ai ces erreurs (alors que sur mon Pc cela fonctionne bien)

    Exception calling "Add" with "0" argument(s): "Old format or invalid type library. (Exception from HRESULT: 0x80028018
    (TYPE_E_INVDATAREAD))"
    At C:\Users\ADMROOT_fourquemin\Desktop\NTFS.PS1:193 char:1
    + $b = $a.Workbooks.Add()
    + ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ComMethodTargetInvocation

    You cannot call a method on a null-valued expression.
    At C:\Users\ADMROOT_fourquemin\Desktop\NTFS.PS1:194 char:1
    + $d = $b.Worksheets.Item(1)
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    The property 'name' cannot be found on this object. Verify that the property exists and can be set.
    At C:\Users\ADMROOT_fourquemin\Desktop\NTFS.PS1:195 char:1
    + $d.name = "Droits NTFS"
    + ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

    You cannot call a method on a null-valued expression.
    At C:\Users\ADMROOT_fourquemin\Desktop\NTFS.PS1:198 char:1
    + $d.Cells.Item($ligne,$col)= "Fullname"
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    You cannot call a method on a null-valued expression.
    At C:\Users\ADMROOT_fourquemin\Desktop\NTFS.PS1:199 char:1
    + $d.Cells.Item($ligne,$col).Font.Bold = $True
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    You cannot call a method on a null-valued expression.
    At C:\Users\ADMROOT_fourquemin\Desktop\NTFS.PS1:201 char:1
    + $d.Cells.Item($ligne,$col)= "Identity"
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    You cannot call a method on a null-valued expression.
    At C:\Users\ADMROOT_fourquemin\Desktop\NTFS.PS1:202 char:1
    + $d.Cells.Item($ligne,$col).Font.Bold = $True
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    You cannot call a method on a null-valued expression.
    At C:\Users\ADMROOT_fourquemin\Desktop\NTFS.PS1:204 char:1
    + $d.Cells.Item($ligne,$col)= "Rights"
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    You cannot call a method on a null-valued expression.
    At C:\Users\ADMROOT_fourquemin\Desktop\NTFS.PS1:205 char:1
    + $d.Cells.Item($ligne,$col).Font.Bold = $True
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    You cannot call a method on a null-valued expression.
    At C:\Users\ADMROOT_fourquemin\Desktop\NTFS.PS1:207 char:1
    + $d.Cells.Item($ligne,$col)= "IsInherited"
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    You cannot call a method on a null-valued expression.
    At C:\Users\ADMROOT_fourquemin\Desktop\NTFS.PS1:208 char:1
    + $d.Cells.Item($ligne,$col).Font.Bold = $True
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
    Sur mon Pc j'ai Excel 2010 alors que sur le serveur, il y a Excel 2013. J'ai PowerShell 4 sur le serveur et le PowerShell 2 sur mon PC
    Comment rendre compatible mon script ?

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [Infomaniak] Quelles permissions sur fichiers/répertoires ?
    Par Sayrus dans le forum Hébergement
    Réponses: 0
    Dernier message: 22/10/2009, 15h32
  2. Delphi et Permission NTFS (cacls inside)
    Par Raspoutitsa dans le forum Débuter
    Réponses: 0
    Dernier message: 19/08/2009, 16h37
  3. [WD11] Permissions NTFS
    Par WDKyle dans le forum WinDev
    Réponses: 7
    Dernier message: 06/07/2009, 09h29
  4. Modifier les permissions d'un répertoire
    Par zan001 dans le forum Général Java
    Réponses: 0
    Dernier message: 30/04/2009, 18h57
  5. Permissions NTFS avec XP Home
    Par Loceka dans le forum Sécurité
    Réponses: 2
    Dernier message: 10/09/2006, 11h32

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo