$strComputer = ”.”,
$Excel = Ny-Anmärker - Com Excel.Application
$Excel.visible = $True
$Excel = $Excel.Workbooks.Add ()
$Sheet = $Excel.WorkSheets.Item (1)
$Sheet.Cells.Item (1.1) = ”dator”,
$Sheet.Cells.Item (1.2) = ”drev märker”,
$Sheet.Cells.Item (1.3) = ”beskrivning”,
$Sheet.Cells.Item (1.4) = ”FileSystem”,
$Sheet.Cells.Item (1.5) = ”storleksanpassar i GB”,
$Sheet.Cells.Item (1.6) = ”fritt utrymme i GB”,
$WorkBook = $Sheet.UsedRange
$WorkBook.Interior.ColorIndex = 8
$WorkBook.Font.ColorIndex = 11
$WorkBook.Font.Bold = $True
$intRow = 2
$colItems = Får-wmiObject - klassificera ”Win32_LogicalDisk” - namespace-”rotar \ CIMV2” `,
- computername $strComputer
foreach ($objItem i $colItems) {
$Sheet.Cells.Item ($intRow, 1) = $objItem.SystemName
$Sheet.Cells.Item ($intRow, 2) = $objItem.DeviceID
$Sheet.Cells.Item ($intRow, 3) = $objItem.Description
$Sheet.Cells.Item ($intRow, 4) = $objItem.FileSystem
$Sheet.Cells.Item ($intRow, 5) = $objItem.Size/1GB
$Sheet.Cells.Item ($intRow, 6) = $objItem.FreeSpace/1GB
$intRow = $intRow + 1
$WorkBook.EntireColumn.AutoFit ()
}
$intRow = $intRow + 1
$Sheet = $Excel.WorkSheets.Item (1)
$Sheet.Cells.Item ($introw, 1) = ”produkt”,
$Sheet.Cells.Item ($introw, 2) = ”försäljare”,
$Sheet.Cells.Item ($introw, 3) = ”version”,
$Sheet.Cells.Item ($introw, 4) = ”installerar daterar”,
$introw = $introw + 1
$Keys = Får-ChildItem HKLM: \ Programvara \ Microsoft \ Windows \ CurrentVersion \ Uninstall
$Items = $keys | foreach-anmärka {Få-ItemProperty $_.PsPath}, | var-anmärka {($_.DisplayName - notmatch”uppdatering|Hotfix”) - och ($_.DisplayName - ne $null)}
foreach ($item i $items) {
$Sheet.Cells.Item ($intRow, 1) = $Item.DisplayName
$Sheet.Cells.Item ($intRow, 2) = $Item.Publisher
$Sheet.Cells.Item ($intRow, 3) = $Item.DisplayVersion
$Sheet.Cells.Item ($intRow, 4) = $Item.InstallDate
$intRow = $intRow + 1
}
$WorkBook.EntireColumn.AutoFit ()
Frikänd
|