-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInstallConfigClientWin.ps1
More file actions
80 lines (68 loc) · 2.99 KB
/
InstallConfigClientWin.ps1
File metadata and controls
80 lines (68 loc) · 2.99 KB
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
<#
NOM DU SCRIPT: InstallConfigClientWin.ps1
*================================================================*
DESCRIPTION:
Le script va nous permettre de :
1 :Installer le client Windows de BackupPC
2 :Configurer la règle de firewall pour Rsync(873)
3 :Enregistre dans un fichier le nom netbios du poste et
d'autres informations.
*================================================================*
AUTEUR: Daniel DOS SANTOS < daniel.massy91@gmail.com >
*================================================================*
DATE DE CREATION: 24/04/2019
*================================================================*
USAGE: PS C:\Users> powershell ./InstallConfigClientWin.ps1
*================================================================*
POWERSHELL VERSION: 5.1
*================================================================*
#>
### Fonctions ###
function message ($1)
{
Write-Host " "
Write-Host " "
Write-Host "$1"
Write-Host "---------------------------------------------------------------------------------" -f green -b black
}
### Début du code ###
# Message d'accueil
write-host ""
write-host "-----------------------------------------"
write-host "* *"
write-host "* Script client BackupPC *"
write-host "* *"
write-host "-----------------------------------------"
write-host ""
Start-Sleep 2
# Dossier principale
mkdir $env:USERPROFILE\Atout
message "Téléchargement du client Windows pour BackupPC en cours"
Invoke-WebRequest -Uri https://www.logicbox.fr/download/DesktopClient_LogicBackup_1.0.0.1_installer.exe -OutFile $env:USERPROFILE\Atout\DesktopClient_LogicBackup_1.0.0.1_installer.exe
Clear-Host
# "/S" pour une installation non graphique
message "Installation du client en cours"
Start-Process $env:USERPROFILE\Atout\DesktopClient_LogicBackup_1.0.0.1_installer.exe "/S"
Clear-Host
# Configuration du firewall de Windows
message "Ouverture dur port TCP 873 en trafic entrant en cours"
new-netfirewallrule -name "BackupPC" -displayname "BackupPC port 873" -profile domain,public,private -enabled true -protocol TCP -localport 873 -Action allow
Start-Sleep 6
Clear-Host
# Informations sur le poste client
$chemin="$env:USERPROFILE\Atout\poste_$env:userdomain.txt"
message "Récupération des informations utiles concernant le poste client en cours"
message "Informations poste client $env:userdomain" *>> $chemin
get-wmiobject Win32_computersystem >> $chemin
message "Nom Netbios" *>> $chemin
$env:userdomain.tolower() >> $chemin
message "Configuration Réseau" *>> $chemin
Get-NetIPConfiguration >> $chemin
Remove-Item $env:USERPROFILE\Atout\DesktopClient_LogicBackup_1.0.0.1_installer.exe
message "Les informations ont été enregistrées dans le fichier : $chemin"
write-host ""
write-host "-----------------------------------------"
write-host "* Fin du script ! *"
write-host "-----------------------------------------"
write-host ""
invoke-item $env:USERPROFILE\Atout