Empty Coder
Empty Coder

Reputation: 589

Alternate for Export-Excel

Below is the code where i am using Export-Excel to create a excel workbook where based on each service name there will be worksheet which will be created

$Hash = [ordered]@{"Server Name"="$ServerName";"Service Name"="$ServiceName";"Time(GMT)"="$GMTTime";"Time(EPOCH)"="$FEpoch"}
              foreach ($Property in $Properties) {
                  $Hash[$Property] = (($BlockData.$Property | Measure -Sum).Sum)/$blockvalue
                  }
   
   [pscustomobject]$Hash | Export-Excel "C:\script\Final_Report.xlsx" -WorksheetName $ServiceName -Append

But now the server where i have to execute the code needs admin access to install ImportExcel module in order to get the export-excel cmdlet.

Need idea on any alternate for doing this.

Upvotes: 0

Views: 177

Answers (1)

Doug Maurer
Doug Maurer

Reputation: 8868

But now the server where i have to execute the code needs admin access to install ImportExcel module in order to get the export-excel cmdlet.

This is not completely accurate. You can specify the scope to install the module in.

Install-Module importexcle -Scope currentuser

See the answer here for a nice explanation.

Upvotes: 2

Related Questions