Hey everyone, I’m having trouble with a script i’m building to get informations from active directory.
Here’s my code
{
#[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') | Out-Null
Import-Module PowerShellAccessControl
#$Chemin = [Microsoft.VisualBasic.Interaction]::InputBox("entrer un chemin")
write-host " Z: (lettre de lecteur utilisée pour \\Aietes\Echange_RH) " -backgroundcolor black -foregroundcolor yellow
write-host " X: (lettre de lecteur utilisée pour \\Aietes\Echanges_Entreprises) " -backgroundcolor black -foregroundcolor yellow
write-host " W: (lettre de lecteur utilisée pour \\Aietes\Siege_Manpower) " -backgroundcolor black -foregroundcolor yellow
write-host "Entrez le chemin Ci dessous" -ForegroundColor Yellow
[string]$chemin = read-host
Get-AccessControlEntry $chemin|select-object principal, accessmask, info
write-host "--------------Le groupe est dans la colonne principal et les droits appliqué par ce dernier sous AccessMask--------------" -backgroundcolor black -foregroundcolor yellow
write-host " Merci de copié le nom du groupe désiré " -backgroundcolor black -foregroundcolor yellow
write-host " Accessmask donne les droits appliqué par ce groupe " -backgroundcolor black -foregroundcolor yellow
write-host " 2032127 = controle total, 1245631 = Lecture + écriture, 1179817= Lecture seulement " -backgroundcolor black -foregroundcolor yellow
write-host " entrer ici le nom du groupe désiré pour obtenir le gestionnaire: " -backgroundcolor black -foregroundcolor green
$group = read-host
get-adgroup $group -server *myserver* -properties *|select-object description,info |Format-Tablepause}
My problem is with the bold part, i need the user to enter a path bu some paths have space in them and it just doesn’t work with those.Sorry for the french parts in it but its just infos for the user.
If the string value in a variable contains spaces, wraping inside quotes are not required. Above Get-ChildItem example is expected to work.
Get-AccessControlEntry works with path which contains spaces as well. what is the exact error you are getting ?
Welp, turns out you’re right, kvprasoon. (I guess I’m conditioned to equate path space issues with double quoting lol) There must be another issue here, OP could you provide any error output you’re receiving?
Hey everyone thanks a lot for the answers you already provided.
I have a problem here, my powershell is in french and i haven’t figured out how to change it for now since i’m on a professional computer and i’m fairly new to powershell
Below you will find my error message that i translated myself.
Thanks a lot for the answer guys.
GetPathInformation : Type [Microsoft.Experimental.IO.LongPathDirectory] can't be found. make sure thats the assembly contening this type is loaded.
To the caracther C:\Users\8003108\Documents\WindowsPowerShell\Modules\PowerShellAccessControl\PowerShellAccessControl.psm1:1861 : 34
+ foreach ($ObjectInfo in (GetPathInformation @PSBoundParameters)) {
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,GetPathInformation
Do i need a newer version of powershellaccesscontrol?