Pregled instalirane verzije programa, npr. Adobe Reader na svim radnim stanicama koje se nalaze na spisku c:\skripte\comp.txt
################################################################################
$cred = Get-Credential banini\administrator
$comp = get-content c:\skripte\comp.txt
$s = New-PSSession -computerName $comp -credential $cred
Invoke-Command -Session $s -Scriptblock {Get-WmiObject -Class Win32_Product -filter "name LIKE 'Adobe read%'"}
exit-pssession
################################################################################
Restartovanje AutomaticUpdate servisa na radnim stanicama koje se nalaze na spisku c:\skripte\comp.txt i brisanje sadrzaja foldera C:\Windows\SoftwareDistribution
################################################################################
$cred = Get-Credential banini\administrator
$comp = get-content c:\skripte\comp.txt
$s = New-PSSession -computerName $comp -credential $cred
Invoke-Command -Session $s -Scriptblock {stop-service wuauserv
remove-item C:\Windows\SoftwareDistribution\* -recurse -force
start-service wuauserv}
exit-pssession
################################################################################
Inventar hardvera na radnoj stanici na kojoj se pokrece skripta
################################################################################
$name = (Get-Item env:\Computername).Value
$filepath = (Get-ChildItem env:\userprofile).value
$smtp = "Your-ExchangeServer"
$to = "YourIT@YourDomain.com"
$subject = "Hardware Info of $name"
$attachment = "$filepath\$name.html"
$from = (Get-Item env:\username).Value + "@yourdomain.com"
$a = "<style>"
$a = $a + "BODY{background-color:Lavender ;}"
$a = $a + "TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}"
$a = $a + "TH{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:thistle}"
$a = $a + "TD{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:PaleGoldenrod}"
$a = $a + "</style>"
ConvertTo-Html -Head $a -Title "Hardware Information for $name" -Body "<h1> Naziv računara : $name </h1>" > "$filepath\$name.html"
# Maticna ploca:
Win32_BaseBoard # You can Also select Tag,Weight,Width
Get-WmiObject -ComputerName $name Win32_BaseBoard | Select Name,Manufacturer,Product,SerialNumber,Status | ConvertTo-html -Body "<H2> Matična ploča</H2>" >> "$filepath\$name.html"
# Napajanje
Get-WmiObject Win32_Battery -ComputerName $name | Select Caption,Name,DesignVoltage,DeviceID,EstimatedChargeRemaining,EstimatedRunTime | ConvertTo-html -Body "<H2> Napajanje</H2>" >> "$filepath\$name.html"
# BIOS
Get-WmiObject win32_bios -ComputerName $name | Select Manufacturer,Name,BIOSVersion,ListOfLanguages,PrimaryBIOS,ReleaseDate,SMBIOSBIOSVersion,SMBIOSMajorVersion,SMBIOSMinorVersion | ConvertTo-html -Body "<H2> BIOS </H2>" >> "$filepath\$name.html"
# CD ROM Drive
Get-WmiObject Win32_CDROMDrive -ComputerName $name | select Name,Drive,MediaLoaded,MediaType,MfrAssignedRevisionLevel | ConvertTo-html -Body "<H2> CD/DWD ROM</H2>" >> "$filepath\$name.html"
# System
Get-WmiObject Win32_ComputerSystemProduct -ComputerName $name | Select Vendor,Version,Name,IdentifyingNumber,UUID | ConvertTo-html -Body "<H2> System </H2>" >> "$filepath\$name.html"
# Hard-Disk
Get-WmiObject win32_diskDrive -ComputerName $name | select Model,SerialNumber,InterfaceType,Size,Partitions | ConvertTo-html -Body "<H2> Harddisk </H2>" >> "$filepath\$name.html"
# NetWord Adapters -ComputerName $name
Get-WmiObject win32_networkadapter -ComputerName $name | Select Name,Manufacturer,Description ,AdapterType,Speed,MACAddress,NetConnectionID | ConvertTo-html -Body "<H2> Nerwork Card</H2>" >> "$filepath\$name.html"
# Memory
Get-WmiObject Win32_PhysicalMemory -ComputerName $name | select BankLabel,DeviceLocator,Capacity,Manufacturer,PartNumber,SerialNumber,Speed | ConvertTo-html -Body "<H2> Memorija</H2>" >> "$filepath\$name.html"
# Processor
Get-WmiObject Win32_Processor -ComputerName $name | Select Name,Manufacturer,Caption,DeviceID,CurrentClockSpeed,CurrentVoltage,DataWidth,L2CacheSize,L3CacheSize,NumberOfCores,NumberOfLogicalProcessors,Status | ConvertTo-html -Body "<H2> CPU </H2>" >> "$filepath\$name.html"
## System enclosure
Get-WmiObject Win32_SystemEnclosure -ComputerName $name | Select Tag,AudibleAlarm,ChassisTypes,HeatGeneration,HotSwappable,InstallDate,LockPresent,PoweredOn,PartNumber,SerialNumber | ConvertTo-html -Body "<H2> System Enclosure Information </H2>" >> "$filepath\$name.html"
## Invoke Expressons
invoke-Expression "$filepath\$name.html"
#### Sending Email
Send-MailMessage -To nikola.batinica@banini.co.rs -Subject $subject -From nikola.batinica@banini.co.rs $subject -SmtpServer cp1.cpanelhosting.rs -Priority "High" -BodyAsHtml -Attachments "$filepath\$name.html"
Inventar hardvera na radnoj stanici na kojoj se pokrece skripta
################################################################################
$name = (Get-Item env:\Computername).Value
$filepath = (Get-ChildItem env:\userprofile).value
$smtp = "Your-ExchangeServer"
$to = "YourIT@YourDomain.com"
$subject = "Hardware Info of $name"
$attachment = "$filepath\$name.html"
$from = (Get-Item env:\username).Value + "@yourdomain.com"
$a = "<style>"
$a = $a + "BODY{background-color:Lavender ;}"
$a = $a + "TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}"
$a = $a + "TH{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:thistle}"
$a = $a + "TD{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:PaleGoldenrod}"
$a = $a + "</style>"
ConvertTo-Html -Head $a -Title "Hardware Information for $name" -Body "<h1> Naziv računara : $name </h1>" > "$filepath\$name.html"
# Maticna ploca:
Win32_BaseBoard # You can Also select Tag,Weight,Width
Get-WmiObject -ComputerName $name Win32_BaseBoard | Select Name,Manufacturer,Product,SerialNumber,Status | ConvertTo-html -Body "<H2> Matična ploča</H2>" >> "$filepath\$name.html"
# Napajanje
Get-WmiObject Win32_Battery -ComputerName $name | Select Caption,Name,DesignVoltage,DeviceID,EstimatedChargeRemaining,EstimatedRunTime | ConvertTo-html -Body "<H2> Napajanje</H2>" >> "$filepath\$name.html"
# BIOS
Get-WmiObject win32_bios -ComputerName $name | Select Manufacturer,Name,BIOSVersion,ListOfLanguages,PrimaryBIOS,ReleaseDate,SMBIOSBIOSVersion,SMBIOSMajorVersion,SMBIOSMinorVersion | ConvertTo-html -Body "<H2> BIOS </H2>" >> "$filepath\$name.html"
# CD ROM Drive
Get-WmiObject Win32_CDROMDrive -ComputerName $name | select Name,Drive,MediaLoaded,MediaType,MfrAssignedRevisionLevel | ConvertTo-html -Body "<H2> CD/DWD ROM</H2>" >> "$filepath\$name.html"
# System
Get-WmiObject Win32_ComputerSystemProduct -ComputerName $name | Select Vendor,Version,Name,IdentifyingNumber,UUID | ConvertTo-html -Body "<H2> System </H2>" >> "$filepath\$name.html"
# Hard-Disk
Get-WmiObject win32_diskDrive -ComputerName $name | select Model,SerialNumber,InterfaceType,Size,Partitions | ConvertTo-html -Body "<H2> Harddisk </H2>" >> "$filepath\$name.html"
# NetWord Adapters -ComputerName $name
Get-WmiObject win32_networkadapter -ComputerName $name | Select Name,Manufacturer,Description ,AdapterType,Speed,MACAddress,NetConnectionID | ConvertTo-html -Body "<H2> Nerwork Card</H2>" >> "$filepath\$name.html"
# Memory
Get-WmiObject Win32_PhysicalMemory -ComputerName $name | select BankLabel,DeviceLocator,Capacity,Manufacturer,PartNumber,SerialNumber,Speed | ConvertTo-html -Body "<H2> Memorija</H2>" >> "$filepath\$name.html"
# Processor
Get-WmiObject Win32_Processor -ComputerName $name | Select Name,Manufacturer,Caption,DeviceID,CurrentClockSpeed,CurrentVoltage,DataWidth,L2CacheSize,L3CacheSize,NumberOfCores,NumberOfLogicalProcessors,Status | ConvertTo-html -Body "<H2> CPU </H2>" >> "$filepath\$name.html"
## System enclosure
Get-WmiObject Win32_SystemEnclosure -ComputerName $name | Select Tag,AudibleAlarm,ChassisTypes,HeatGeneration,HotSwappable,InstallDate,LockPresent,PoweredOn,PartNumber,SerialNumber | ConvertTo-html -Body "<H2> System Enclosure Information </H2>" >> "$filepath\$name.html"
## Invoke Expressons
invoke-Expression "$filepath\$name.html"
#### Sending Email
Send-MailMessage -To nikola.batinica@banini.co.rs -Subject $subject -From nikola.batinica@banini.co.rs $subject -SmtpServer cp1.cpanelhosting.rs -Priority "High" -BodyAsHtml -Attachments "$filepath\$name.html"
#################################################################################
Нема коментара:
Постави коментар