Question Statut d'un Runspace

Plus d'informations
il y a 8 ans 7 mois #24384 par Laurent
Réponse de Laurent sur le sujet Re:Statut d'un Runspace
Merci pour ta réponse

La partie ci dessous c'est exactement ce que je recherche, mais je n'arrive pas à l'adapter à ma solution beaucoup de variable dans son code et je ne sais pas à quoi cela correspond. Comment obtient le \"State\" du Runspace ?

[code:1]$State = If ($list[$_].handle.IsCompleted -AND -NOT [bool]$CRP) {
'Completed'
}
ElseIf (-NOT $list[$_].handle.IsCompleted -AND [bool]$CRP) {
'Running'
}
ElseIf (-NOT $list[$_].handle.IsCompleted -AND -NOT [bool]$CRP) {
'NotStarted'[/code:1]

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 8 ans 7 mois #24385 par crogiez
Réponse de crogiez sur le sujet Re:Statut d'un Runspace
bonjour

çà sert à quoi de faire un menu
avec 2 casse à cocher
qui lance 1 ligne de code ?

sachant qu'on pourrait faire
moninstall.ps1 /options:1
ou
moninstall.ps1 /options:2
ou
moninstall.ps1 /options:1,2

!!!

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 8 ans 7 mois #24386 par Laurent
Réponse de Laurent sur le sujet Re:Statut d'un Runspace
Bonjour crogiez,

L'utilisateur final doit pouvoir choisir les logiciels qu'il souhaite installer avec une interface graphique pour chaque case cochée un logiciel est installé (un autre script est lancé).

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 8 ans 7 mois #24387 par crogiez
Réponse de crogiez sur le sujet Re:Statut d'un Runspace
[code:1]
#powershell menu 3 options - november 2015
#philippe crogiez - french english
#http://crogiez.free.fr - Cette adresse e-mail est protégée contre les robots spammeurs. Vous devez activer le JavaScript pour la visualiser.

[void] [System.Reflection.Assembly]::LoadWithPartialName(\"System.Drawing\"«»)
[void] [System.Reflection.Assembly]::LoadWithPartialName(\"System.Windows.Forms\"«»)
[void] [System.Windows.Forms.Application]::EnableVisualStyles()

function ecrit_log($llogf){

#rem create log
$llog=get-date -Format \"yyyy-MM-dd-HH-mm-ss\"
$llog=$llog+\";\"+$llogf
$llog
$llog >> $malog
}


function Affiche_Menu{

$Form = New-Object system.Windows.Forms.Form
$Form.Size = New-Object System.Drawing.Size(400,200)
$form.MaximizeBox = $false
$Form.StartPosition = \"CenterScreen\"
$Form.FormBorderStyle = 'Fixed3D'
$Form.Text = \"Mon titre\"

#icon en haut a gauche
$path_icon=$mondossier+\"bing.ico\"

#$formIcon = New-Object system.drawing.icon ($path_icon)
#$form.Icon = $formicon

$Font = New-Object System.Drawing.Font(\"Arial\",15,[System.Drawing.FontStyle]::Bold)
$form.Font = $Font

$Label = New-Object System.Windows.Forms.Label
$Label.Location = New-Object System.Drawing.Size(10,10)
$Label.Text = \"Quel est votre choix ?\"
$Label.AutoSize = $true
$Form.Controls.Add($Label)


$O1button = New-Object System.Windows.Forms.Button
$O1button.Location = New-Object System.Drawing.Size(140,40)
$O1button.Size = New-Object System.Drawing.Size(120,30)
$O1button.Text = \"Option1\"
$O1button.Add_Click({$form.Close();$arr_menu[0]=1})
$Form.Controls.Add($O1button)

$O2button = New-Object System.Windows.Forms.Button
$O2button.Location = New-Object System.Drawing.Size(140,70)
$O2button.Size = New-Object System.Drawing.Size(120,30)
$O2button.Text = \"Option2\"
$O2button.Add_Click({$form.Close();$arr_menu[0]=2})
$Form.Controls.Add($O2button)

$O3button = New-Object System.Windows.Forms.Button
$O3button.Location = New-Object System.Drawing.Size(140,100)
$O3button.Size = New-Object System.Drawing.Size(120,30)
$O3button.Text = \"Option3\"
$O3button.Add_Click({$form.Close();$arr_menu[0]=3})
$Form.Controls.Add($O3button)

$Form.ShowDialog()

}


#recuperation du dossier courant
$monchemin=$MyInvocation.InvocationName
$monchemin
$mondossier=(split-path -Path $monchemin -Parent) + \"\\"
$mondossier
$monscript=split-path -path $monchemin -leaf
$monscript
$malog=$mondossier+$monscript.Substring(0,$monscript.IndexOf(\".\"«»))+\".log\"
$malog


#rem create log
$mlog=\"
\"; ecrit_log($mlog)
$mlog=$monchemin; ecrit_log($mlog)



#il faut passer l'arg dans un tableau

#alors l'arg est passé et reçu par référence

#ici l'arg n'est pas passé, il est contenu dans tableau

#et la fonction Option* le modifie

$arr_menu=@(0)

Affiche_Menu

$arr_menu[0]

$mlog=$arr_menu[0]; ecrit_log($mlog)



if($arr_menu[0] -eq 0){

\"Vous n'avez rien choisi\"

$mlog=\"Vous n'avez rien choisi\"; ecrit_log($mlog)

}

if($arr_menu[0] -eq 1){

\"Vous avez choisi le 1\"

$mlog=\"Vous avez choisi le 1\"; ecrit_log($mlog)

}

if($arr_menu[0] -eq 2){

\"Vous avez choisi le 2\"

$mlog=\"Vous avez choisi le 2\"; ecrit_log($mlog)

}

if($arr_menu[0] -eq 3){

\"Vous avez choisi le 3\"

$mlog=\"Vous avez choisi le 3\"; ecrit_log($mlog)

}



#rem fin log

$mlog=\"end\"; ecrit_log($mlog)

[/code:1]

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 8 ans 7 mois #24388 par crogiez
Réponse de crogiez sur le sujet Re:Statut d'un Runspace
affichage perpétuel
jusquà Exit

[code:1]
#powershell menu 3 options - november 2015
#philippe crogiez - french english
#http://crogiez.free.fr - Cette adresse e-mail est protégée contre les robots spammeurs. Vous devez activer le JavaScript pour la visualiser.
# oct 2017 - affiche perpetuel

[void] [System.Reflection.Assembly]::LoadWithPartialName(\"System.Drawing\"«»)
[void] [System.Reflection.Assembly]::LoadWithPartialName(\"System.Windows.Forms\"«»)
[void] [System.Windows.Forms.Application]::EnableVisualStyles()

function ecrit_log($llogf){

#rem create log
$llog=get-date -Format \"yyyy-MM-dd-HH-mm-ss\"
$llog=$llog+\";\"+$llogf
$llog
$llog >> $malog
}


function Affiche_Menu{

$Form = New-Object system.Windows.Forms.Form
$Form.Size = New-Object System.Drawing.Size(400,200)
$form.MaximizeBox = $false
$Form.StartPosition = \"CenterScreen\"
$Form.FormBorderStyle = 'Fixed3D'
$Form.Text = \"Mon titre\"

#icon en haut a gauche
$path_icon=$mondossier+\"bing.ico\"

#$formIcon = New-Object system.drawing.icon ($path_icon)
#$form.Icon = $formicon

$Font = New-Object System.Drawing.Font(\"Arial\",15,[System.Drawing.FontStyle]::Bold)
$form.Font = $Font

$Label = New-Object System.Windows.Forms.Label
$Label.Location = New-Object System.Drawing.Size(10,10)
$Label.Text = \"Quel est votre choix ?\"
$Label.AutoSize = $true
$Form.Controls.Add($Label)


$O1button = New-Object System.Windows.Forms.Button
$O1button.Location = New-Object System.Drawing.Size(140,40)
$O1button.Size = New-Object System.Drawing.Size(120,30)
$O1button.Text = \"Option1\"
$O1button.Add_Click({$form.Close();$arr_menu[0]=1})
$Form.Controls.Add($O1button)

$O2button = New-Object System.Windows.Forms.Button
$O2button.Location = New-Object System.Drawing.Size(140,70)
$O2button.Size = New-Object System.Drawing.Size(120,30)
$O2button.Text = \"Option2\"
$O2button.Add_Click({$form.Close();$arr_menu[0]=2})
$Form.Controls.Add($O2button)

$O3button = New-Object System.Windows.Forms.Button
$O3button.Location = New-Object System.Drawing.Size(140,100)
$O3button.Size = New-Object System.Drawing.Size(120,30)
$O3button.Text = \"Exit\"
$O3button.Add_Click({$form.Close();$arr_menu[0]=3})
$Form.Controls.Add($O3button)

$Form.ShowDialog()

}


#recuperation du dossier courant
$monchemin=$MyInvocation.InvocationName
$monchemin
$mondossier=(split-path -Path $monchemin -Parent) + \"\\"
$mondossier
$monscript=split-path -path $monchemin -leaf
$monscript
$malog=$mondossier+$monscript.Substring(0,$monscript.IndexOf(\".\"«»))+\".log\"
$malog

#rem create log
$mlog=\"
\"; ecrit_log($mlog)
$mlog=$monchemin; ecrit_log($mlog)

#on affiche le menu tout le temps
#jusqua option Exit
$affiche_menu=$true

while ($affiche_menu -eq $true)
{

#il faut passer l'arg dans un tableau
#alors l'arg est passé et reçu par référence
#ici l'arg n'est pas passé, il est contenu dans tableau
#et la fonction Option* le modifie
$arr_menu=@(0)
Affiche_Menu

\"apres saisi menu\"
$arr_menu[0]
$mlog=$arr_menu[0]; ecrit_log($mlog)

if($arr_menu[0] -eq 0){
\"Vous n'avez rien choisi\"
$mlog=\"Vous n'avez rien choisi\"; ecrit_log($mlog)
}

if($arr_menu[0] -eq 1){
\"Vous avez choisi le 1\"
$mlog=\"Vous avez choisi le 1\"; ecrit_log($mlog)
}

if($arr_menu[0] -eq 2){
\"Vous avez choisi le 2\"
$mlog=\"Vous avez choisi le 2\"; ecrit_log($mlog)
}

if($arr_menu[0] -eq 3){
\"Exit\"
$mlog=\"Exit\"; ecrit_log($mlog)
$affiche_menu=$false
}
}

#rem fin log

$mlog=\"end\"; ecrit_log($mlog)

[/code:1]

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 8 ans 7 mois #24389 par crogiez
Réponse de crogiez sur le sujet Re:Statut d'un Runspace
avec message dans le menu perpetuel
[code:1]
#powershell menu 3 options - november 2015
#philippe crogiez - french english
#http://crogiez.free.fr - Cette adresse e-mail est protégée contre les robots spammeurs. Vous devez activer le JavaScript pour la visualiser.
# oct 2017 - affiche perpetuel

[void] [System.Reflection.Assembly]::LoadWithPartialName(\"System.Drawing\"«»)
[void] [System.Reflection.Assembly]::LoadWithPartialName(\"System.Windows.Forms\"«»)
[void] [System.Windows.Forms.Application]::EnableVisualStyles()

function ecrit_log($llogf){

#rem create log
$llog=get-date -Format \"yyyy-MM-dd-HH-mm-ss\"
$llog=$llog+\";\"+$llogf
$llog
$llog >> $malog
}


function Affiche_Menu{

$Form = New-Object system.Windows.Forms.Form
$Form.Size = New-Object System.Drawing.Size(400,200)
$form.MaximizeBox = $false
$Form.StartPosition = \"CenterScreen\"
$Form.FormBorderStyle = 'Fixed3D'
$Form.Text = \"Mon titre\"

#icon en haut a gauche
$path_icon=$mondossier+\"bing.ico\"

#$formIcon = New-Object system.drawing.icon ($path_icon)
#$form.Icon = $formicon

$Font = New-Object System.Drawing.Font(\"Arial\",15,[System.Drawing.FontStyle]::Bold)
$form.Font = $Font

$Label1 = New-Object System.Windows.Forms.Label
$Label1.Location = New-Object System.Drawing.Size(10,10)
$Label1.Text = \"Quel est votre choix ?\"
$Label1.AutoSize = $true
$Form.Controls.Add($Label1)

$O1button = New-Object System.Windows.Forms.Button
$O1button.Location = New-Object System.Drawing.Size(140,40)
$O1button.Size = New-Object System.Drawing.Size(120,30)
$O1button.Text = \"Option1\"
$O1button.Add_Click({$form.Close();$arr_menu[0]=1})
$Form.Controls.Add($O1button)

$O2button = New-Object System.Windows.Forms.Button
$O2button.Location = New-Object System.Drawing.Size(140,70)
$O2button.Size = New-Object System.Drawing.Size(120,30)
$O2button.Text = \"Option2\"
$O2button.Add_Click({$form.Close();$arr_menu[0]=2})
$Form.Controls.Add($O2button)

$O3button = New-Object System.Windows.Forms.Button
$O3button.Location = New-Object System.Drawing.Size(140,100)
$O3button.Size = New-Object System.Drawing.Size(120,30)
$O3button.Text = \"Exit\"
$O3button.Add_Click({$form.Close();$arr_menu[0]=3})
$Form.Controls.Add($O3button)

$Label2 = New-Object System.Windows.Forms.Label
$Label2.Location = New-Object System.Drawing.Size(10,130)
$Label2.Text = $arr_menu[1]
$Label2.AutoSize = $true
$Form.Controls.Add($Label2)

$Form.ShowDialog()

}

#recuperation du dossier courant
$monchemin=$MyInvocation.InvocationName
$monchemin
$mondossier=(split-path -Path $monchemin -Parent) + \"\\"
$mondossier
$monscript=split-path -path $monchemin -leaf
$monscript
$malog=$mondossier+$monscript.Substring(0,$monscript.IndexOf(\".\"«»))+\".log\"
$malog

#rem create log
$mlog=\"
\"; ecrit_log($mlog)
$mlog=$monchemin; ecrit_log($mlog)

#on affiche le menu tout le temps
#jusqua option Exit
$affiche_menu=$true

#il faut passer l'arg dans un tableau
#alors l'arg est passé et reçu par référence
#ici l'arg n'est pas passé, il est contenu dans tableau
#et la fonction Option* le modifie
$arr_menu=@()
$arr_menu+=\"\";$arr_menu[0]=0
$arr_menu+=\"\";$arr_menu[1]=\"message\"

while ($affiche_menu -eq $true)
{

Affiche_Menu

\"apres saisi menu\"
$arr_menu[0]
$mlog=$arr_menu[0]; ecrit_log($mlog)

if($arr_menu[0] -eq 0){
\"Vous n'avez rien choisi\"
$mlog=\"Vous n'avez rien choisi\"; ecrit_log($mlog)
}

if($arr_menu[0] -eq 1){
\"Vous avez choisi le 1\"
$mlog=\"Vous avez choisi le 1\"; ecrit_log($mlog)
$arr_menu[1]=$mlog
}

if($arr_menu[0] -eq 2){
\"Vous avez choisi le 2\"
$mlog=\"Vous avez choisi le 2\"; ecrit_log($mlog)
$arr_menu[1]=$mlog
}

if($arr_menu[0] -eq 3){
\"Exit\"
$mlog=\"Exit\"; ecrit_log($mlog)
$affiche_menu=$false
}
}

#rem fin log

$mlog=\"end\"; ecrit_log($mlog)


[/code:1]

Connexion ou Créer un compte pour participer à la conversation.

Temps de génération de la page : 0.055 secondes
Propulsé par Kunena