Auteur de questions
Comment ajouter un lien dans Powershell Html

Question
-
Bonjour mes très chers!! je viens au près de vous, parce que j'ai rencontré un problème avec mon petit script powershell HTML.
Mon script consiste a créer des Applications RemoteApps sur Windows Serveur 2012, mais en voulant créer une interface graphique avec HTML, je pas su mettre des lien vers d'autres script.ps1, pour ne pas trop vous inquiéter le script passe a merveille mais ce juste les liens vers d'autre scripts d'un genre me compliquent. les scripts sont enregistré avec l’extension .ps1, si vous pouvez m'aider je vous serez infiniment reconnaissant,
merci d'avance
voila mon script:
$html = @"
voilà un peu ce que ça
<html>
<head>
<style>
h1{
background-color: SlateGray;
text-align: center;
color:AliceBlue;
font-size: 50px;
border-radius: 20px;
text-shadow:
0 1px 0 #CCCCCC,
0 2px 0 #b5b5b5,
0 3px 0 #9B9B9B,
0 4px 0 #898989,
0 5px 0 #7B7B7B,
0 6px 0 #626262
;
}
#fiox{
background-color: AliceBlue;
width: 1200px;
text-align: center;
border-radius: 20px;
padding: 10px;
margin: 50px auto;
box-shadow: 10px 10px 0px DarkGray;
}
#fiox form input{
border-radius: 10px;
padding: 5px;
width: 200px;
height: 30px;
}
body{
background: SlateGray;
}
#lien{
background-color: AliceBlue;
width: 1200px;
text-align: center;
border-radius: 20px;
padding: 10px;
margin: 50px auto;
}
#lien a{
display:block;
width:200px;
height:30px;
background:Lavender;
margin-right:10px;
padding:5px;
float:left;
text-align:center;
text-decoration:none;
border-radius: 20px;
}
#lien a:hover{
background:GreenYellow;
}
</style>
</head>
<body>
<p>...</p>
<h1> POWERSHELL DEPLOIEMENT RESSOURCES </h1>
<div id = 'lien'>
<a href ='D:\Cours\Mon TFE\Chapitre fini\RDS.ps1'>Acceuil</a>
<a href ='https://srvrds02.aspnet.local/RDweb'>Connection au RDS</a>
<a href =''>Apropos de nous</a>
<a href =''>Aide</a>
</div>
<div id = 'fiox'>
<form>
<input type="text" id="Username" placeholder = "Domain\Username..." required>
<input type="password" id="password" placeholder = "Votre password..." required><br/><br/>
<input type="text" id="dossier" placeholder = "le nom du dossier..." required><br/><br/>
<input type="text" id="alias" placeholder = "le nom du programme..." required><br/><br/>
<input type="text" id="UserGroup" placeholder = "le groupe utilisateur du programme..." required><br/><br/>
Inserer le chemin vers le ficher .exe : <br/><br/><input type="text" id="chemin" required><br/><br/>
<input type="hidden" name="finished" value="0">
<input type="button" id="button" value="Deployer" onclick="finished.value=1">
<input type="reset" value="Reset" name="Retour">
</form>
</div>
<table id = 'bas' width="1200" border="0" align="center">
<tr bgcolor="AliceBlue">
<td width="276" class="style1"><div align="center">
<a href ='https://www.google.cd'>recherche google</a><br/>
<a href ='https://www.techday.com'>forum TechDay</a><br/>
<a href ='https://technet.microsoft.com'>recherche sur le site microsoft</a><br/>
<a href ='http://fr.wikipedia.org'>recherche sur wikipedia</a><br/>
<a href ='http://www.blog-note.com'>Mon blog</a><br/>
<a href ='http://www.isdecisions.fr'>recherche google</a><br/>
</div>
</td>
<td width="312">
<span class="style1"><marquee behavior="alternate"><img src="file:///C|/Users/001aspnet/Desktop/SCript/8.jpg" width="585" height="143" alt="dd" /></marquee></span>
</td>
<td width="321"><h2 align="center"><strong>Information</strong></h2>
<p>Sun est aussi constructeur de terminaux, la gamme Sun Ray, dont les tarifs comme la qualité (avec lecteur de <br />
carte intégré et réellement fonctionnel)<br />
</p></td>
</tr>
</table>
</body>
</html>
"@
$ie = new-object -com "InternetExplorer.Application"
$ie.navigate("about:blank")
$ie.AddressBar = $true
$ie.MenuBar = $true
$ie.StatusBar = $true
$ie.document.body.innerHTML = $html
$ie.Visible = $true
$doc = $ie.document
while ($doc.getElementByID("finished").value -ne 1) {
start-sleep -m 500
}
$ie.Visible = $true
# recuperation des valeurs saisies dans des variables
$Username = $doc.getElementByID("Username").value
$Password = $doc.getElementByID("password").value
$Dossier = $doc.getElementByID("dossier").value
$Alias = $doc.getElementByID("alias").value
$Chemin = $doc.getElementByID("chemin").value
$UserGrouper = $doc.getElementByID("UserGroup").value
Function Test-ADAuthentication {
(new-object directoryservices.directoryentry "",$Username,$Password).psbase.name -ne $null
}Test-ADAuthentication
$connexion = Test-ADAuthentication
if( $connexion -ne "True"){
[System.Windows.Forms.MessageBox]::Show("Votre UserName ou PassWord est incorrect.")
}else{
New-RDRemoteApp -CollectionName "RemoteAppCollection" -Alias $Alias -DisplayName $Alias -FolderName $Dossier -FilePath $Chemin -UserGroups $UserGrouper
[void][Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[System.Windows.Forms.MessageBox]::Show("L'application créer a été déployé.")
}
dont:
- Déplacé Jean-Sébastien DUCHÊNEMVP vendredi 29 août 2014 09:52 Mauvais Forum ; Question relative à PowerShell
- Modifié Michee Fiox samedi 30 août 2014 03:48 preciser
Toutes les réponses
-
Tu peux utiliser un composant ActiveX genre un WScript.Shell et appeler ton script depuis ce composant. Mais Internet Explorer va bloquer le contenu par defaut et afficher des tas de messages d'avertissement.
etre que tu peux regarder du cote des HTAs: How to Add a Graphical User Interface to a PowerShell Script by Using HTML Applications http://social.technet.microsoft.com/wiki/contents/articles/2166.how-to-add-a-graphical-user-interface-to-a-powershell-script-by-using-html-applications.aspx
Ou bien opter pour le Presentation Framework: Secrets to Building a WPF Application in Windows PowerShell http://msdn.microsoft.com/en-us/magazine/hh288074.aspx
Ou alors les Windows Forms: Build User-Friendly XML Interfaces with Windows PowerShell http://msdn.microsoft.com/en-us/magazine/jj553514.aspx
Note: Posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.
-
-
Salut,
il existait PrimalForms Community Edition de Sapiens pour la conception de Forms en WYSIWYG, mais celle-ci n'est plus disponible en téléchargement.
Une autre possibilité est d'utiliser Visual Studio Express ou supérieure pour définir une Form dans un projet VS C#, puis de convertir un de ces fichiers en un script .PS1 à l'aide du module ConvertForm.
Ce projet bien qu'en cours de portage est fonctionnel.Par exemple le projet suivant peut servir de base à l'insertion de contrôles de validation des données dans la GUI présentée.
Beatus, qui prodest, quibus potest.
- Modifié Dardenne LaurentMVP, Moderator samedi 30 août 2014 18:43 correction URL
-