Question
Personnalisation du profil
- Granier
- Auteur du sujet
- Hors Ligne
- Membre junior
Réduire
Plus d'informations
- Messages : 27
- Remerciements reçus 0
il y a 14 ans 1 semaine #6512
par Granier
Personnalisation du profil a été créé par Granier
Bonjour
J'essaye votre script du livre dans le chapitre \"personnalisation du profil\" paragraphe 4 \"creation du profil\" et j'ai une erreur sur la commande :
[code:1]$principal = new-object System.Security.principal.windowsprincipal [/code:1]
le shell me renvoie l'erreur suivante:
[code:1]New-Object : Constructeur introuvable. Impossible de trouver un constructeur approprié pour le type System.Security.pri
ncipal.windowsprincipal.
Au niveau de C:\Users\tgranier\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 : 20 Caractère : 24
+ $principal = new-object <<<< System.Security.principal.windowsprincipal
+ CategoryInfo : ObjectNotFound: (:«») [New-Object], PSArgumentException
+ FullyQualifiedErrorId : CannotFindAppropriateCtor,Microsoft.PowerShell.Commands.NewObjectCommand[/code:1]
Pouvez-vous m'aider SVP ?
Merci d'avance
Thierry<br><br>Message édité par: Arnaud, à: 13/04/10 08:38
J'essaye votre script du livre dans le chapitre \"personnalisation du profil\" paragraphe 4 \"creation du profil\" et j'ai une erreur sur la commande :
[code:1]$principal = new-object System.Security.principal.windowsprincipal [/code:1]
le shell me renvoie l'erreur suivante:
[code:1]New-Object : Constructeur introuvable. Impossible de trouver un constructeur approprié pour le type System.Security.pri
ncipal.windowsprincipal.
Au niveau de C:\Users\tgranier\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 : 20 Caractère : 24
+ $principal = new-object <<<< System.Security.principal.windowsprincipal
+ CategoryInfo : ObjectNotFound: (:«») [New-Object], PSArgumentException
+ FullyQualifiedErrorId : CannotFindAppropriateCtor,Microsoft.PowerShell.Commands.NewObjectCommand[/code:1]
Pouvez-vous m'aider SVP ?
Merci d'avance
Thierry<br><br>Message édité par: Arnaud, à: 13/04/10 08:38
Connexion ou Créer un compte pour participer à la conversation.
- Arnaud Petitjean
- Hors Ligne
- Modérateur
il y a 14 ans 1 semaine #6513
par Arnaud Petitjean
MVP PowerShell et créateur de ce magnifique forum
Auteur de 6 livres PowerShell aux éditions ENI
Fondateur de la société Start-Scripting
Besoin d'une formation PowerShell ?
Réponse de Arnaud Petitjean sur le sujet Re:Personnalisation du profil
Bonjour Thierry,
Si tu regardes bien le message d'erreur retourné (si si je te le conseille car on y trouve plein de choses intéressantes ), il manque un constructeur.
Autrement dit, il faut que tu utilises la syntaxe suivante :
[code:1]$principal = new-object System.Security.principal.windowsprincipal($currentuser)[/code:1]
En ayant bien sûr pris soin au préalable de donner une valeur à la variable $currentuser.
Soit le code suivant :
[code:1]
$currentuser=[system.security.principal.windowsidentity]::getcurrent()
$principal = new-object System.Security.principal.windowsprincipal($currentuser)
[/code:1]
Arnaud
Si tu regardes bien le message d'erreur retourné (si si je te le conseille car on y trouve plein de choses intéressantes ), il manque un constructeur.
Autrement dit, il faut que tu utilises la syntaxe suivante :
[code:1]$principal = new-object System.Security.principal.windowsprincipal($currentuser)[/code:1]
En ayant bien sûr pris soin au préalable de donner une valeur à la variable $currentuser.
Soit le code suivant :
[code:1]
$currentuser=[system.security.principal.windowsidentity]::getcurrent()
$principal = new-object System.Security.principal.windowsprincipal($currentuser)
[/code:1]
Arnaud
MVP PowerShell et créateur de ce magnifique forum
Auteur de 6 livres PowerShell aux éditions ENI
Fondateur de la société Start-Scripting
Besoin d'une formation PowerShell ?
Connexion ou Créer un compte pour participer à la conversation.
Temps de génération de la page : 0.064 secondes
- Vous êtes ici :
- Accueil
- forum
- PowerShell
- Entraide pour les débutants
- Personnalisation du profil