Question
Enable-PSRemoting depuis psexec
- Howard
- Auteur du sujet
- Hors Ligne
- Nouveau membre
-
Réduire
Plus d'informations
- Messages : 3
- Remerciements reçus 0
il y a 11 ans 8 mois #17854
par Howard
Enable-PSRemoting depuis psexec a été créé par Howard
Salut,
Je bloque sur un point qui devient assez énervant. Je veux activer le PSRemoting sur mes postes distants en utilisant psexec (pas d'autres moyens de le faire ...). Quand je lance le script entier, j'ai mon invite PS qui affiche que je dois avoir des privilèges pour exécuter la commande alors que j'ai mis un compte d'admin du domaine dans la commande :
[code:1]
$ComputersRemote = Get-Content .\ComputersRemote.txt
foreach ($computer in $ComputersRemote)
{
Start-Process powershell.exe -verb RunAs
Domaine\AdminAccount -NoNewWindow -ArgumentList
\"C:\Script\psexec \\$computer -u
Domaine\AdminAccount -p P@ssw0rd Powershell
Enable-PSRemoting -Force\"
}
[/code:1]
Où est l'erreur please ?
Merci
Je bloque sur un point qui devient assez énervant. Je veux activer le PSRemoting sur mes postes distants en utilisant psexec (pas d'autres moyens de le faire ...). Quand je lance le script entier, j'ai mon invite PS qui affiche que je dois avoir des privilèges pour exécuter la commande alors que j'ai mis un compte d'admin du domaine dans la commande :
[code:1]
$ComputersRemote = Get-Content .\ComputersRemote.txt
foreach ($computer in $ComputersRemote)
{
Start-Process powershell.exe -verb RunAs
Domaine\AdminAccount -NoNewWindow -ArgumentList
\"C:\Script\psexec \\$computer -u
Domaine\AdminAccount -p P@ssw0rd Powershell
Enable-PSRemoting -Force\"
}
[/code:1]
Où est l'erreur please ?
Merci
Connexion ou Créer un compte pour participer à la conversation.
- Gabriel
-
- Hors Ligne
- Membre elite
-
Réduire
Plus d'informations
- Messages : 248
- Remerciements reçus 1
il y a 11 ans 8 mois #17856
par Gabriel
Réponse de Gabriel sur le sujet Re:Enable-PSRemoting depuis psexec
Salut
tu doit encapsuler ta commande enter \"{}\"
[code:1]
PS Travail:\> help about_PowerShell.exe -Detailed
TOPIC
about_PowerShell.exe
SHORT DESCRIPTION
Explains how to use the PowerShell.exe command-line tool. Displays
the syntax and describes the command-line switches.
PowerShell.exe starts a Windows PowerShell session. You can use it
in Cmd.exe and in Windows PowerShell.
LONG DESCRIPTION
SYNTAX
PowerShell[.exe]
[-EncodedCommand <Base64EncodedCommand>]
[-ExecutionPolicy <ExecutionPolicy>]
[-InputFormat {Text | XML}]
[-Mta]
[-NoExit]
[-NoLogo]
[-NonInteractive]
[-NoProfile]
[-OutputFormat {Text | XML}]
[-PSConsoleFile <FilePath> | -Version <Windows PowerShell version>]
[-Sta]
[-WindowStyle <style>]
[-File <FilePath> [<Args>]]
[-Command { - | <script-block> [-args <arg-array>]
| <string> [<CommandParameters>] } ]
PowerShell[.exe] -Help | -? | /?
................
EXAMPLES
PowerShell -PSConsoleFile sqlsnapin.psc1
PowerShell -Version 2.0 -NoLogo -InputFormat text -OutputFormat XML
PowerShell -Command {Get-EventLog -LogName security}
PowerShell -Command \"& {Get-EventLog -LogName security}\"
[/code:1]
ensuite je pense que ton psexec n'a pas le chemin par defaut il faut aussi envisager de mettre le chemin complet de powershell.exe, genre :
[code:1]
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command {Enable-PSRemoting -Force}
[/code:1]
cordialement.
tu doit encapsuler ta commande enter \"{}\"
[code:1]
PS Travail:\> help about_PowerShell.exe -Detailed
TOPIC
about_PowerShell.exe
SHORT DESCRIPTION
Explains how to use the PowerShell.exe command-line tool. Displays
the syntax and describes the command-line switches.
PowerShell.exe starts a Windows PowerShell session. You can use it
in Cmd.exe and in Windows PowerShell.
LONG DESCRIPTION
SYNTAX
PowerShell[.exe]
[-EncodedCommand <Base64EncodedCommand>]
[-ExecutionPolicy <ExecutionPolicy>]
[-InputFormat {Text | XML}]
[-Mta]
[-NoExit]
[-NoLogo]
[-NonInteractive]
[-NoProfile]
[-OutputFormat {Text | XML}]
[-PSConsoleFile <FilePath> | -Version <Windows PowerShell version>]
[-Sta]
[-WindowStyle <style>]
[-File <FilePath> [<Args>]]
[-Command { - | <script-block> [-args <arg-array>]
| <string> [<CommandParameters>] } ]
PowerShell[.exe] -Help | -? | /?
................
EXAMPLES
PowerShell -PSConsoleFile sqlsnapin.psc1
PowerShell -Version 2.0 -NoLogo -InputFormat text -OutputFormat XML
PowerShell -Command {Get-EventLog -LogName security}
PowerShell -Command \"& {Get-EventLog -LogName security}\"
[/code:1]
ensuite je pense que ton psexec n'a pas le chemin par defaut il faut aussi envisager de mettre le chemin complet de powershell.exe, genre :
[code:1]
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command {Enable-PSRemoting -Force}
[/code:1]
cordialement.
Connexion ou Créer un compte pour participer à la conversation.
Temps de génération de la page : 0.038 secondes
- Vous êtes ici :
-
Accueil
-
forum
-
PowerShell
-
Entraide pour les débutants
- Enable-PSRemoting depuis psexec