-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSysInfo-NetworkDrive.ps1
More file actions
57 lines (47 loc) · 2.12 KB
/
SysInfo-NetworkDrive.ps1
File metadata and controls
57 lines (47 loc) · 2.12 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
# Liste de TOUTES les varriables pour TOUT prendre sur le PC
$computerSystem = Get-WmiObject CIM_ComputerSystem
$computerBIOS = Get-WmiObject CIM_BIOSElement
$computerOS = Get-CimInstance CIM_OperatingSystem
$computerCPU = Get-WmiObject CIM_Processor
$computerHDD = Get-WmiObject Win32_LogicalDisk -Filter "DeviceID = 'C:'"
$Disk = Get-Disk -Partition (Get-Partition | Where-Object { $_.DriveLetter -eq "C" })
$DiskInfo = Get-PhysicalDisk | Where-Object { $_.FriendlyName -eq $Disk.FriendlyName }
$whoami = whoami
$AV = Get-WmiObject -Namespace "root\SecurityCenter2" -Class AntiVirusProduct | Select-Object -ExpandProperty displayName
$date = Get-Date -Format "dd-MM-yyyy"
$networkShare = "\\SERVER\SHARE"
#Clear de la fenetre PowerSHell
Clear-Host
Write-Host "Information copié"
function Sysinfo {
$info = @(
"Nom du PC: " + $computerSystem.Name
"Fabricant: " + $computerSystem.Manufacturer
"Model: " + $computerSystem.Model
"Numero de serie: " + $computerBIOS.SerialNumber
"OS: " + $computerOS.Caption
"Service Pack: " + $computerOS.ServicePackMajorVersion
"CPU: " + $computerCPU.Name
"RAM: " + "{0:N2}" -f ($computerSystem.TotalPhysicalMemory/1GB) + "GB"
"Type de disque: " + $DiskInfo.MediaType
"Taille de C: " + "{0:N2}" -f ($computerHDD.Size/1GB) + "GB"
"Espace disque: " + "{0:P2}" -f ($computerHDD.FreeSpace/$computerHDD.Size) + " libre (" + "{0:N2}" -f ($computerHDD.FreeSpace/1GB) + "GB)"
"Dernier reboot: " + $computerOS.LastBootUpTime
"Utilisateur: " + $whoami
"Antivirus: " + $AV
"Localisation: "
"-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+"
)
$info -join "`n"
}
# Rename du fichier avec le nom du PC et de la date
$outputFile = Join-Path $networkShare ($computerSystem.Name + "_" + $date + ".txt")
# Envoie des infos vers le fichiers txt
Sysinfo | Out-File $outputFile
# Print completion message in green text
Write-Host "Info enregistré vers $outputFile"
# Clear de la fenetre PowerShell
Clear-Host
Write-Host "Fin du script!"
# Ouvrir le txt si besoin
# Start-Process notepad $outputFile