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
| $form = new-object Windows.Forms.form
$form.Size = new-object System.Drawing.Size @(480,400)
$form.text = "Message"
$boutton = new-object System.Windows.Forms.Button
$boutton.Text = 'Oui'
$boutton.size = new-object System.Drawing.Size(120,30)
$boutton.Location = new-object System.Drawing.Size(300,130)
$boutton.Add_Click({$form.Close()})
$boutton2 = new-object System.Windows.Forms.Button
$boutton2.Text = 'Annuler'
$boutton2.Location = new-object System.Drawing.Size(300,100)
$boutton2.size = new-object System.Drawing.Size(120,30)
$list_disk=""
#get-psdrive | ? {$_.Provider -match "FileSystem"} |foreach-object {$List_disk+=$_.root + "`n"}
$tableau = New-Object System.Collections.ArrayList(50)
get-psdrive | ? {$_.Provider -match "FileSystem"} |foreach-object {$List_disk+=$_.root + "`n"}
$tableau = $List_disk
$listboxS = new-object System.Windows.Forms.ListBox
[void]$listboxS.Items.Add($List_Disk)
$listboxS.Location = new-object System.Drawing.Size(50,75)
$listboxS.size = new-object System.Drawing.Size(200,100)
$listboxD = new-object System.Windows.Forms.ListBox
$listboxD.Location = new-object System.Drawing.Size(50,200)
$listboxD.size = new-object System.Drawing.Size(200,100)
$label = New-Object System.Windows.Forms.Label
$label.text = "Faire un back-up"
$label.Location = new-object System.Drawing.Size(55,30)
$label.size = new-object System.Drawing.Size(200,20)
$label2 = New-Object System.Windows.Forms.Label
$label2.Location = new-object System.Drawing.Size(310,220)
$label2.size = new-object System.Drawing.Size(180,20)
$form.Controls.Add($boutton)
$form.Controls.Add($boutton2)
$form.Controls.Add($label)
$form.Controls.Add($label2)
$form.Controls.Add($listboxS)
$form.Controls.Add($listboxD)
$Form.Add_Shown({$form.Activate()})
[void]$form.showdialog()
[IO.Directory]::CreateDirectory("P:\122\a_compresser\compresse")
gci . -recurse -exclude compresse | move-item -dest P:\122\a_compresser\compresse
$backups = ls P:\122\a_compresser
foreach ($dir in $backups) {
P:\122\7-Zip\7z.exe a $dir
}
gci . -recurse -include *.7z | move-item -dest P:\122\en_attente
gci . -recurse -exclude *.7z | move-item -dest P:\122\originaux
$c = new-object -comobject wscript.shell
$d = $c.popup("Back up réussi!") |
Partager