Questione : Domanda di Powershell WMI

Ciao, il

I ha scritto uno scritto di Powershell per interrogare alcune informazioni circa i nostri assistenti. Stavo domandando se qualcuno potesse dirmi come omettere le parole “Hotfix„ e “l'aggiornamento„ dalla scrittura al foglio elettronico di supremazia? Inoltre, fra gli elenchi di programma, ci sono lacune a volte enormi betweeen i programmi. Potete prego dirmi che cosa sta causando questo e come ripararlo?

Thank you
class= > " libero " del
> " del codeSnippet " del class= del
class= " lineNumbers " del
class= del
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:
class= " del id= " codeSnippet800458 del
$strComputer = “.„

$Excel = Nuovo-Oggetto - COM Excel.Application
$Excel.visible = $True
$Excel = $Excel.Workbooks.Add ()

$Sheet = $Excel.WorkSheets.Item (1)
$Sheet.Cells.Item (1.1) = “calcolatore„
$Sheet.Cells.Item (1.2) = “lettera di azionamento„
$Sheet.Cells.Item (1.3) = “descrizione„
$Sheet.Cells.Item (1.4) = “FileSystem„
$Sheet.Cells.Item (1.5) = “formato in GB„
$Sheet.Cells.Item (1.6) = “spazio libero in GB„


$WorkBook = $Sheet.UsedRange
$WorkBook.Interior.ColorIndex = 8
$WorkBook.Font.ColorIndex = 11
$WorkBook.Font.Bold = $True

$intRow = 2
$colItems = Ottengono-wmiObject - classificare “Win32_LogicalDisk„ - il `del namespace “radice \ CIMV2„
- computername $strComputer

foreach ($objItem in $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) = “prodotto„
$Sheet.Cells.Item (7.2) = “fornitore„
$Sheet.Cells.Item (7.3) = “versione„
$Sheet.Cells.Item (7.4) = “installano la data„

$intRow = 7
$Keys = Ottengono-ChildItem HKLM: \ Software \ Microsoft \ Windows \ CurrentVersion \ disinstallano

$Items = $keys |foreach-oggetto {Ottenere-ItemProperty $_.PsPath}

foreach ($item in $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 ()
}

Radura
class= del

Risposta : Domanda di Powershell WMI

Ciao Brent,

Ho fatto alcuni ritocchi che dovrebbero fare che cosa state cercando.  Invierò ancora presto la spiegazione dell'ogni cambiamento.

Acclamazioni,

D
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:
$strComputer = “.„

$Excel = Nuovo-Oggetto - COM Excel.Application
$Excel.visible = $True
$Excel = $Excel.Workbooks.Add ()

$Sheet = $Excel.WorkSheets.Item (1)
$Sheet.Cells.Item (1.1) = “calcolatore„
$Sheet.Cells.Item (1.2) = “lettera di azionamento„
$Sheet.Cells.Item (1.3) = “descrizione„
$Sheet.Cells.Item (1.4) = “FileSystem„
$Sheet.Cells.Item (1.5) = “formato in GB„
$Sheet.Cells.Item (1.6) = “spazio libero in GB„


$WorkBook = $Sheet.UsedRange
$WorkBook.Interior.ColorIndex = 8
$WorkBook.Font.ColorIndex = 11
$WorkBook.Font.Bold = $True

$intRow = 2
$colItems = Ottengono-wmiObject - classificare “Win32_LogicalDisk„ - il `del namespace “radice \ CIMV2„
- computername $strComputer

foreach ($objItem in $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) = “prodotto„
$Sheet.Cells.Item ($introw, 2) = “fornitore„
$Sheet.Cells.Item ($introw, 3) = “versione„
$Sheet.Cells.Item ($introw, 4) = “installano la data„

$introw = $introw + 1
$Keys = Ottengono-ChildItem HKLM: \ Software \ Microsoft \ Windows \ CurrentVersion \ disinstallano

$Items = $keys | foreach-oggetto {Ottenere-ItemProperty $_.PsPath} | dove-oggetto {($_.DisplayName - aggiornamento del notmatch “|Ne $null di Hotfix„) - e ($_.DisplayName -)}

foreach ($item in $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 ()

Radura
Altre soluzioni  
 
programming4us programming4us