Create an Inventory of the Local Computer Getting Computer Services
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
[sourcecode language='powershell' ] #Define the ComputerName $computer = 'Localhost' #Define the Excel fillename and the worksheetname $Filename = 'Localhost-Inventory.xlsx' $WorkSheetName = 'Services' #Create a New Document held in computer memory $Doc = New-SLDocument #Generate the Service Information Get-Service -ComputerName $computer | Export-SLData -WorkBookInstance $doc -WorksheetName $WorkSheetName | Set-SLTableStyle -TableStyle Medium15 -Verbose | Save-SLDocument -Path (Join-Path 'c:\temp\excel' -ChildPath $Filename) -Verbose [/sourcecode] |
The Output should look like this PS C:\> VERBOSE: Select-SLWorkSheet : Worksheet ‘Services’ is now selected VERBOSE: Set-SLTableStyle : Setting TableStyle ‘Medium15′ on CellRange – StartRow/StartColumn ‘5’:’2′ & EndRow/EndColumn ‘184’:’16’ VERBOSE: Save-SLDocument : Document has been Saved to ‘c:\temp\excel\Localhost-Inventory.xlsx’ Check […]