PowerShell: Add a line number to each item in a variable...


hello powershell friends,

so here's looking do:

i have script runs daily; i've defined variable in script, $users, domain users added variable when condition met - $true/$false. each day e-mail report listing contents of "$users" (obviously changes daily). looking html code (inside loop? dunno, that's why here) list variables in numbered list such as:

1. user in variable
2. user in variable
3. user in variable
etc...

currently output is:

user in variable
user in variable
user in variable

is there simple way of doing this? there is, haven't figured out... always, brains , support appreciated :)

you're counter keeps getting reset 1.

that means initialization line ($counter = 1) needs move outside of loop that's writing html lines.  want initialization run 1 time.


[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

CRL Revocation always failed

0x300000d errors in Microsoft Remote Desktop client

Failed to query the results of bpa xpath