Sortable HTML table with Powershell -


is possible script below create sortable html table without using javascript? of examples have found far require use of javascript. if possible purely done in powershell.

#set variables $image = "c:\scriptrepository\nhsi(left).gif" $convertimage = [convert]::tobase64string((get-content $image -encoding byte)) $imagehtml = "<img src=data:image/gif;base64,$($convertimage) alt=nhsi/>" $currentdate = get-date -format f  #function alternating table colour rows function global:set-alternatingrows {                 [cmdletbinding()]                 param(                 [parameter(mandatory,valuefrompipeline)]                 [string]$line,                  [parameter(mandatory)]                 [string]$cssevenclass,                  [parameter(mandatory)]                 [string]$cssoddclass                 )     begin {                 $classname = $cssevenclass         }     process {                 if ($line.contains("<tr><td>"))                 {   $line = $line.replace("<tr>","<tr class=""$classname"">")                 if ($classname -eq $cssevenclass)                 {   $classname = $cssoddclass }                 else                 {   $classname = $cssevenclass             }         }     return $line     } }      #function validate request , create variable input function global:getadgroupmembersrecursively {     write-host "enter distribution list / ad group name:" -foregroundcolor green     $global:adgroupname = read-host     if ([string]::isnullorempty($adgroupname))     {      cls     write-host -foregroundcolor red "cannot blank, please re-enter ad group / distribution list name" | out-null     getadgroupmembersrecursively      }     $global:dlcheck = dsquery group -name "$adgroupname"     if ($dlcheck -eq $null)      {      cls     write-host -foregroundcolor red "did not find ad group / distribution list, please verify correct name" | out-null     getadgroupmembersrecursively   } }  getadgroupmembersrecursively  $head = @" <style> body {font-family: arial; font-size: 8pt; color: #000000; background-color: #ffffff;} table{margin: auto; font-family: segoe ui; box-shadow: 10px 10px 5px #4c607b; width: 100%;height :50px;} th, td {border: 1px solid #ffffff; border-collapse: collapse;padding: 3px;} th {font-size: 1.2em; background-color: #003366; color: #ffffff; } td {color: #000000; }  .even { background-color: #efefef; }  .odd { background-color: #c0c0c0; } tr { background: #b8d1f3; }" h4 {font-family: arial; font-size: 12pt; color: #4c607b;align=right;} h5 {font-family: arial; font-size: 8pt; color: #4c607b;align=right;} </style> "@   #table creation $post = "<br><br> members of $adgroupname <br> generated on $currentdate" get-adgroupmember -identity $adgroupname -recursive | get-aduser -pr givenname,surname,mail,samaccountname | select-object @{name = "first name"; expression = {$_.givenname}}, @{name = "last name"; expression = {$_.surname}}, @{name = "email address"; expression = {$_.mail}}, @{name = "user account"; expression = {$_.samaccountname}} | sort surname |  convertto-html -head $head -body $imagehtml -postcontent $post -as table | set-alternatingrows -cssoddclass odd -cssevenclass | out-file c:\scriptrepository\results\$adgroupname.htm invoke-item c:\scriptrepository\results\$adgroupname.htm 

is possible script below create sortable html table without using javascript?

no. not possible limitation or @ least not current html. might able vbscript in page not surprised if off limits well.

the thing think within confines have laid out roll out separate reports, within same html file, show preferred sorting options , not all sorting options.

something else or in conjunction create csv file. way recipients read in data program or text editor notepad++ , have sorting you. understand if not within scope of task still valid option in general.

if possible purely done in powershell.

another option might "out there" instead of html output use out-gridview. provide interactive interface data. if users ones running script option available them.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -