1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368
| ####################################################################################
# Simplification d'ajout & suppression de licence O365
# Début du script
####################################################################################
# Page 1 - page d'accueil
####################################################################################
# Début.form1
####################################################################################
# Chargement des Windows Form
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Windows.forms")
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Drawinf")
#################################################
# CONNEXION AU SERVICE OFFICE 365
#################################################
# Demande de connexion à Office 365
#$username = (Get-Item Env:\USERNAME).Value + "@******.fr"
#$cred = Get-Credential -Message "Entrez vos informations d'identification :" -UserName $username
#Connect-MSOLService -Credential $cred
#################################################
# CONFIGURATION DE LA WINDOWS FORM
#################################################
# Creation de la form principale
$form1 = New-Object Windows.Forms.form
# Pour supprimer le bouton quitter (croix rouge)
$form1.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedDialog
$form1.ControlBox = $false
# Pour mettre la fenêtre en grand écran
$form1.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedDialog
$form1.WindowState="Maximized"
# Titre
$form1.Text = "Centre d'administation des licences O365 - ******"
#################################################
# AJOUT DES COMPOSANTS
#################################################
# Bouton Suivant
$button_suivant = New-Object System.Windows.Forms.Button
$button_suivant.Text = "Suivant"
$button_suivant.AutoSize = $true
$button_suivant.Font = New-Object System.Drawing.Font("Arial", 10)
$button_suivant.Size = New-Object System.Drawing.Size(115,45)
$button_suivant.Location = New-Object System.drawing.Size(400,180)
# Bouton Fermer
$button_fermer = New-Object System.Windows.Forms.Button
$button_fermer.Text = "Fermer"
$button_fermer.AutoSize = $true
$button_fermer.Font = New-Object System.Drawing.Font("Arial", 10)
$button_fermer.Size = New-Object System.drawing.Size(115,45)
$button_fermer.Location = New-Object System.drawing.Size(700,180)
# Label 1 : Titre présentation
$label_un = New-Object System.Windows.Forms.Label
$label_un.AutoSize = $true
$Label_un.Location = New-Object System.Drawing.Point(300,40)
$label_un.Size = New-Object System.Drawing.Size(1000,1000)
$label_un.Font = New-Object System.Drawing.Font("Arial", 18)
$label_un.Text = "Bienvenue dans le centre d'administration de Office 365"
# Label 2 : Explication du script
$label_deux = New-Object System.Windows.Forms.Label
$label_deux.AutoSize = $true
$label_deux.Location = New-Object System.Drawing.Point(150,120)
$label_deux.Size = New-Object System.Drawing.Size(50,600)
$label_deux.Font = New-Object System.Drawing.Font("Arial", 11.5)
$label_deux.Text = "Ce logiciel, nous permettra de simplifier l'ajout et la suppression des licences Office 365 aux utilisateurs ******"
#################################################
# GESTION D'EVENEMENTS
#################################################
# Gestion d'événement quand on clique sur le bouton fermer
$button_fermer.Add_Click(
{
$form1.Close()
$form2.Close()
$form3.Close()
})
# Gestion d'événement quand on clique sur le bouton suivant
$button_suivant.Add_Click(
{
$form1.Hide()
$form2.ShowDialog()
})
# Ajout des composants a la Form
$form1.Controls.Add($button_suivant)
$form1.Controls.Add($button_fermer)
$form1.Controls.Add($label_un)
$form1.Controls.Add($label_deux)
# Affichage de la fenêtre
$form1.ShowDialog()
####################################################################################
# Fin.form1
####################################################################################
# Page 2 - Recherche du ou des utilisateurs
####################################################################################
# Début.form2
####################################################################################
# Chargement des Windows Form
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Windows.forms")
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Drawinf")
#################################################
# CONFIGURATION DE LA WINDOWS FORM
#################################################
# Creation de la form principale
$form2 = New-Object Windows.Forms.form
# Pour supprimer le bouton quitter (croix rouge)
$form2.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedDialog
$form2.ControlBox = $false
# Pour mettre la fenêtre en grand écran
$form2.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedDialog
$form2.WindowState="Maximized"
# Titre
$form2.Text = "Centre d'administation des licences O365 - ******"
#################################################
# AJOUT DES COMPOSANTS
#################################################
# Bouton Suivant
$button_suivant2 = New-Object System.Windows.Forms.Button
$button_suivant2.Text = "Suivant"
$button_suivant2.Size = New-Object System.Drawing.Size(75,23)
$button_suivant2.Location = New-Object System.drawing.Size(40,120)
# Bouton Fermer
$Button_fermer2 = New-Object System.Windows.Forms.Button
$button_fermer2.Text = "Fermer"
$button_fermer2.Size = New-Object System.drawing.Size(75,23)
$button_fermer2.Location = New-Object System.drawing.Size(150,120)
# Label 1 : Champs de recherche d'un utilisateur
$Label_1 = New-Object System.Windows.Forms.Label
$Label_1.Location = New-Object System.Drawing.Point(10,20)
$label_1.Size = New-Object System.Drawing.Size(280,20)
$label_1.Text = "Veuillez entrer le nom et prénom du / des utilisateurs : "
$textbox = New-Object System.Windows.Forms.TextBox
$TextBox.Location = New-Object System.Drawing.Point(10,80)
$textbox.Size = New-Object System.Drawing.Size(260,20)
$form2.Controls.Add($textBox)
$form2.Topmost = $true
$form2.Add_Shown({$textbox.Select})
if ($result -eq [System.Windows.Forms.DialogResult]::OK)
{
$x = $textBox
$x
}
#################################################
# GESTION D'EVENEMENTS
#################################################
# Gestion d'événement quand on clique sur le bouton fermer
$button_fermer2.Add_Click(
{
$form2.Close()
$form3.Close()
})
# Gestion d'événement quand on clique sur le bouton suivant
$button_suivant2.Add_Click(
{
$form2.Hide()
$form3.ShowDialog()
})
# Ajout des composants a la Form
$form2.Controls.Add($button_suivant2)
$form2.Controls.Add($button_fermer2)
$form2.Controls.Add($label_1)
$form2.Controls.Add($texbox)
####################################################################################
# Fin.form2
####################################################################################
# Page 3 - Attribution ou Suppression des licences pour un ou plusieurs utilisateurs
####################################################################################
# Début.form3
####################################################################################
# Chargement des Windows Form
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Windows.forms")
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Drawinf")
#################################################
# CONFIGURATION DE LA WINDOWS FORM
#################################################
# Creation de la form principale
$form3 = New-Object Windows.Forms.form
# Pour supprimer le bouton quitter (croix rouge)
$form3.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedDialog
$form3.ControlBox = $false
# Pour mettre la fenêtre en grand écran
$form3.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedDialog
$form3.WindowState="Maximized"
# Titre
$form3.Text = "Centre d'administation des licences O365 - ******"
#################################################
# AJOUT DES COMPOSANTS
#################################################
# Bouton Suivant
$button_suivant3 = New-Object System.Windows.Forms.Button
$button_suivant3.Text = "Suivant"
$button_suivant3.Size = New-Object System.Drawing.Size(120,40)
$button_suivant3.Location = New-Object System.drawing.Size(150,200)
# Bouton Quitter
$Button_fermer3 = New-Object System.Windows.Forms.Button
$button_fermer3.Text = "Fermer"
$button_fermer3.Size = New-Object System.drawing.Size(120,40)
$button_fermer3.Location = New-Object System.drawing.Size(150,250)
# Affichage du nom d'utilisateur recherché
# CheckBox x10 - Case à cocher
$checkbox_un = new-object System.Windows.Forms.CheckBox
$checkbox_un.AutoSize = $true
$checkbox_un.Location = New-Object System.Drawing.Point(30,50)
$checkbox_un.Size = New-Object System.Drawing.Size(60,20)
$checkbox_un.Name = "checkbox_un"
$checkbox_un.Text = "Office 365 Entreprise - E3"
$checkbox_deux = new-object System.Windows.Forms.CheckBox
$checkbox_deux.AutoSize = $true
$checkbox_deux.Location = New-Object System.Drawing.Point(30,70)
$checkbox_deux.Size = New-Object System.Drawing.Size(80,20)
$checkbox_deux.Name = "checkbox_deux"
$checkbox_deux.Text = "Microsoft Planner - E3"
$checkbox_trois = new-object System.Windows.Forms.CheckBox
$checkbox_trois.AutoSize = $true
$checkbox_trois.Location = New-Object System.Drawing.Point(30,90)
$checkbox_trois.Size = New-Object System.Drawing.Size(100,20)
$checkbox_trois.Name = "checkbox_trois"
$checkbox_trois.Text = "Sway - E3"
$checkbox_quatre = new-object System.Windows.Forms.CheckBox
$checkbox_quatre.AutoSize = $true
$checkbox_quatre.Location = New-Object System.Drawing.Point(30,110)
$checkbox_quatre.Size = New-Object System.Drawing.Size(120,20)
$checkbox_quatre.Name = "checkbox_quatre"
$checkbox_quatre.Text = "Yammer Entreprise - E3"
$checkbox_cinq = new-object System.Windows.Forms.CheckBox
$checkbox_cinq.AutoSize = $true
$checkbox_cinq.Location = New-Object System.Drawing.Point(30,130)
$checkbox_cinq.Size = New-Object System.Drawing.Size(140,20)
$checkbox_cinq.Name = "checkbox_cinq"
$checkbox_cinq.Text = "Azure Rights Management - E3"
$checkbox_six = new-object System.Windows.Forms.CheckBox
$checkbox_six.AutoSize = $true
$checkbox_six.Location = New-Object System.Drawing.Point(230,50)
$checkbox_six.Size = New-Object System.Drawing.Size(60,60)
$checkbox_six.Name = "checkbox_six"
$checkbox_six.Text = "Office 365 ProPlus - E3"
$checkbox_sept = new-object System.Windows.Forms.CheckBox
$checkbox_sept.AutoSize = $true
$checkbox_sept.Location = New-Object System.Drawing.Point(230,70)
$checkbox_sept.Size = New-Object System.Drawing.Size(60,90)
$checkbox_sept.Name = "checkbox_sept"
$checkbox_sept.Text = "Skype Entreprise Online (plan 2) - E3"
$checkbox_huit = new-object System.Windows.Forms.CheckBox
$checkbox_huit.AutoSize = $true
$checkbox_huit.Location = New-Object System.Drawing.Point(230,90)
$checkbox_huit.Size = New-Object System.Drawing.Size(60,110)
$checkbox_huit.Name = "checkbox_huit"
$checkbox_huit.Text = "Office Online - E3"
$checkbox_neuf = new-object System.Windows.Forms.CheckBox
$checkbox_neuf.AutoSize = $true
$checkbox_neuf.Location = New-Object System.Drawing.Point(230,110)
$checkbox_neuf.Size = New-Object System.Drawing.Size(60,130)
$checkbox_neuf.Name = "checkbox_neuf"
$checkbox_neuf.Text = "SharePoint Online (plan 2) - E3"
$checkbox_dix = new-object System.Windows.Forms.CheckBox
$checkbox_dix.AutoSize = $true
$checkbox_dix.Location = New-Object System.Drawing.Point(230,130)
$checkbox_dix.Size = New-Object System.Drawing.Size(60,150)
$checkbox_dix.Name = "checkbox_dix"
$checkbox_dix.Text = "Exchange (plan 2) - E3"
#################################################
# GESTION D'EVENEMENTS
#################################################
# Gestion d'événement quand on clique sur le bouton fermer
$button_fermer3.Add_Click(
{
$form3.Close()
})
# Gestion d'événement quand on clique sur le bouton suivant
$button_suivant3.Add_Click(
{
$form3.AcceptButton = $button_suivant3
})
# Ajout des composants a la Form
$form3.Controls.Add($button_suivant3)
$form3.Controls.Add($button_fermer3)
$form3.Controls.Add($checkbox_un)
$form3.Controls.Add($checkbox_deux)
$form3.Controls.Add($checkbox_trois)
$form3.Controls.Add($checkbox_quatre)
$form3.Controls.Add($checkbox_cinq)
$form3.Controls.Add($checkbox_six)
$form3.Controls.Add($checkbox_sept)
$form3.Controls.Add($checkbox_huit)
$form3.Controls.Add($checkbox_neuf)
$form3.Controls.Add($checkbox_dix)
####################################################################################
# Fin.form3
####################################################################################
# Fin du script
#################################################################################### |
Partager