Hi,
I was creating a script that ask you for some input . And convert this to outlook .
I would like to know if someone could tell me how we could create table in script so that in mail info in a table.
Below you can find what i already made:
#Checks wether outlook is running or not
if (Get-Process outlook -ErrorAction silentlycontinue) {
"Outlook already started."
}
else {
Start-Process outlook
}
#Menu Daily telecom check or VC-TP Room Check
[int]$xMenuChoiceA = 0
while ( $xMenuChoiceA -lt 1 -or $xMenuChoiceA -gt 2 ){
Write-host "1. VC-TP Room Check"
Write-host "2. Daily telecom check"
[Int]$xMenuChoiceA = read-host "Please select an option. " }
#Decaration of variables
$o = New-Object -com Outlook.Application
$mail = $o.CreateItem(0)
#Declaration of IF variables
Switch( $xMenuChoiceA ){
#Declaration VC-TP Room Check
1{
$C3 = Read-Host 'C3'
$C4 = Read-Host 'C4'
$C5 = Read-host 'C5'
$Cex = Read-Host 'Cex?'
$Receptiontv = Read-Host 'Reception tv on / off'
$P2 = Read-Host "P2"
$A01 = Read-Host "A01-37"
$A02 = Read-Host "A02-07"
$A04 = Read-Host "A04-40"
$B00 = Read-Host "B00-13"
$mailto = "xxxxx@outlook.com;"
$mailcc = ""}
2{
$Trunk1 = Read-Host 'status trunk 1'
$Trunk10 = Read-Host 'status trunk 10'
$Trunk15 = Read-Host 'status trunk 15'
$Trunk20 = Read-Host 'status trunk 20'
$Trunk30 = Read-Host 'status trunk 30'
$Trunk40 = Read-Host 'status trunk 40'
$Trunk49 = Read-Host 'status trunk 49'
$Trunk50 = Read-Host 'status trunk 50'
$Alarm = Read-Host 'Display alarms'
$FRK1 = Read-Host 'FRK 1'
$FRK2 = Read-Host 'FRK 2'
$FRK3 = Read-Host 'FRK 3'
$ROM1 = Read-Host 'ROM1'
$ROM2 = Read-Host 'ROM2'
$WAR1 = Read-host 'WAR1'
$WAR2 = Read-host 'WAR2'
$EDI1 = Read-Host 'EDI1'
$EDI2 = Read-Host 'EDI2'
$MAD1 = Read-Host 'MAD1'
$MAD2 = Read-host 'MAD2'
$ATH = Read-Host 'ATH'
$BUC = Read-Host 'BUC'
$BUD = Read-Host 'BUD'
$DBN = Read-Host 'DBN'
$PRS = Read-Host 'PRS'
$LON = Read-Host 'LON'
$MOS = Read-Host 'MOS'
$PTB = Read-Host 'PTB'
$PRA = Read-Host 'PRA'
$WARtrev = Read-Host 'Wartrev'
$WARRING = Read-Host 'Warrington'
$WAT = Read-Host 'WAT'
$ZUR = Read-Host 'ZUR'
$STO = Read-Host 'STO'
$KIEV = Read-Host 'KIEV'
$Bruapp30 = Read-Host 'Freespace on Bruapp30'
$SUBextra = Read-Host 'Extra info for subject'
$mailto = "xxxxx@outlook.com;"
$mailcc = ""}
}
$footer = "kind regards,`r`r$myname
Corporate IT
company
street | B-xxxx xxxxx `r
"
# IF switches - body
Switch( $xMenuChoiceA ){
#Declaration IF VC-TP Room Check
1{$subject = "VC-TP Room Check" ; $body = "Hi, `r`r
How do I get the follow view in Outlook with table lines
C3 | √ | P2 | √ |
C4 | √ | A01-37 | √ |
C5 | √ | A02-07 | √ |
C+1 | √ | A04-40 | √ |
Reception tv on | √ | B00-13 | √ |
`r
$footer" }
#Declaration IF Daily telecome check
2{$subject = "Daily telecome check trunks, alarms , media-gateways and backups: $SUBextra " ; $body = "Hi, `r`r
How Do I get the follow view in outlook with table lines
| 16/12/14 6:10 PM |
|
|
|
| |
|
|
|
|
|
|
|
| Status trunks |
|
| PBX backups |
|
|
| 1 | 1 |
| ATH | 1 |
|
| 10 | 1 |
| BUC | 1 |
|
| 15 | 1 |
| BUD | 1 |
|
| 20 | 1 |
| DBN | 1 |
|
| 30 | 1 |
| PRS | 1 |
|
| 40 | 1 |
| LON | 1 |
|
| 49 | 1 |
| MOS | 0 | No audix file |
|
|
|
| PTB | 1 |
|
|
|
|
| PRA | 1 |
|
| Display Alarms | 0 |
| VIENA | 1 |
|
|
|
|
| Warsaw-Trevica | 1 |
|
|
|
|
| WARRIN | 1 |
|
| Media Gateway |
|
| WAT | 1 |
|
| FRK 1 | 1 |
| ZUR | 1 |
|
| FRK 2 | 1 |
| STO | 1 |
|
| FRK 3 | 1 |
| KIEV | 1 |
|
| ROM 1 | 1 |
|
|
|
|
| ROM 2 | 1 |
|
|
|
|
| WAR 1 | 1 |
| bruapp03 space | 47.8 | GB |
| WAR 2 | 1 |
|
|
|
|
| EDI | 0 |
|
|
|
|
| EDI | 0 |
|
|
|
|
| MAD 1 | 1 |
|
|
|
|
| MAD 2 | 1 |
|
|
|
|
|
|
|
|
|
|
|
`r
`r`r
$footer"}
}
# 1 = normal importance 2 = high importance email header
$mail.importance = 1
$mail.subject = "$subject"
$mail.body = $body
#for multiple email, use semi-colon ; to separate
$mail.To = $mailto
$mail.CC = $mailcc
$mail.send()
write-host "sending mail..."
#$yes = New-Object System.Management.Automation.Host.ChoiceDescription"&Send mail",""
#$no = New-Object System.Management.Automation.Host.ChoiceDescription"&Quit",""
#$choices = [System.Management.Automation.Host.ChoiceDescription[]]($yes,$no)
#$caption = "Send e-mail confirmation"
#$message = "Do you want to send the e-mail??"
#$result = $Host.UI.PromptForChoice($caption,$message,$choices,0)
#if($result -eq 0) { $mail.Send()}
#if($result -eq 1) { exit }
# $o.Quit()
Anyone has an idea?