$strComputer = "."
$Excel = Nowy-Protestować - Com Excel.Application
$Excel.visible = $True
$Excel = $Excel.Workbooks.Add ()
$Sheet = $Excel.WorkSheets.Item (1)
$Sheet.Cells.Item (1,1) = "Komputer"
$Sheet.Cells.Item (1,2) = "Przejażdżka List"
$Sheet.Cells.Item (1,3) = "Opis"
$Sheet.Cells.Item (1,4) = "FileSystem"
$Sheet.Cells.Item (1,5) = "Rozmiar w GB"
$Sheet.Cells.Item (1,6) = "Uwalniać Przestrzeń w GB"
$WorkBook = $Sheet.UsedRange
$WorkBook.Interior.ColorIndex = 8
$WorkBook.Font.ColorIndex = 11
$WorkBook.Font.Bold = $True
$intRow = 2
$colItems = Dostawać-wmiObject - klasa "Win32_LogicalDisk" - namespace "korzeń \ CIMV2" `
- computername $strComputer
foreach ($objItem w $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 ()
}
$Sheet = $Excel.WorkSheets.Item (1)
$Sheet.Cells.Item (7,1) = "Produkt"
$Sheet.Cells.Item (7,2) = "Sprzedawca"
$Sheet.Cells.Item (7,3) = "Wersja"
$Sheet.Cells.Item (7,4) = "Instalować Data"
$intRow = 7
$Keys = Dostawać-ChildItem HKLM: \ Oprogramowanie \ Microsoft \ Windows \ CurrentVersion \ Uninstall
$Items = $keys |foreach-protestować {Dostawać-ItemProperty $_.PsPath}
foreach ($item w $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 ()
}
Jasny
|