This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$date = get-date -f yyMMdd | |
function CountZipItems( | |
[__ComObject] $zipFile) | |
{ | |
If ($zipFile -eq $null) | |
{ | |
Throw "Value cannot be null: zipFile" | |
} | |
Write-Host ("Counting items in zip file (" + $zipFile.Self.Path + ")...") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#HTML Table Settings | |
$a = "<style>" | |
$a = $a + "BODY{background-color:peachpuff;}" | |
$a = $a + "TABLE{border-width: 1px; border-style: solid; border-color: black; border-collapse: collapse; vertical-align: top; display: inline-table;}" | |
$a = $a + "TH{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:thistle}" | |
$a = $a + "TD{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:PaleGoldenrod}" | |
$a = $a + "H2{vertical-align: top; display: inline-block;}" | |
$a = $a + "div{vertical-align: top; display: inline-block;}" | |
$a = $a + "</style>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$date = get-date -f yyMMdd | |
#HTML Table Settings | |
$a = "<style>" | |
$a = $a + "BODY{background-color:peachpuff;}" | |
$a = $a + "TABLE{border-width: 1px; border-style: solid; border-color: black; border-collapse: collapse; display: inline-block; float: left; }" | |
$a = $a + "TH{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:thistle}" | |
$a = $a + "TD{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:PaleGoldenrod}" | |
$a = $a + "</style>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PS C:\Users\tech1> Get-Help Out-File -Examples | |
NAME | |
Out-File | |
SYNOPSIS | |
Sends output to a file. | |
-------------------------- EXAMPLE 1 -------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PS C:\Users\tech1> help *out-file | |
SYNOPSIS | |
Sends output to a file. | |
SYNTAX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PS C:\Users\tech1> help *out-file | |
NAME | |
Out-File | |
SYNOPSIS | |
Sends output to a file. | |
SYNTAX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$EmailTo = "helpdesk@derpcompany.com" | |
$EmailFrom = "derp@gmail.com" | |
$Subject = "Test" | |
$Body = "Test Body" | |
$SMTPServer = "smtp.gmail.com" | |
$filenameAndPath = "C:\Users\derptech\Desktop\test.txt" | |
$SMTPMessage = New-Object System.Net.Mail.MailMessage($EmailFrom,$EmailTo,$Subject,$Body) | |
$attachment = New-Object System.Net.Mail.Attachment($filenameAndPath) | |
$SMTPMessage.Attachments.Add($attachment) | |
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Generates Event Report | |
Get-EventLog -LogName Application -Newest 600 -EntryType Error | Sort-Object -Descending Source | | |
Select-Object -Property EntryType, Source | ConvertTo-Html –title EventReport –pre Application_Errors| | |
Out-File A:\SA.adm\EvtReports\EventReport.htm | |
Get-EventLog -LogName Security -Newest 600 -EntryType FailureAudit | Sort-Object -Descending Source | | |
Select-Object -Property EntryType, Source | ConvertTo-Html –pre Security_Errors| | |
Out-File –append A:\SA.adm\EvtReports\EventReport.htm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Generates Event Report | |
Get-EventLog -LogName Application -Newest 600 -EntryType Error | Sort-Object -Descending Source | Select-Object -Property EntryType, Source | ConvertTo-Html –title EventReport –pre Application_Errors| Out-File A:\SA.adm\EvtReports\EventReport.htm | |
Get-EventLog -LogName Security -Newest 600 -EntryType FailureAudit | Sort-Object -Descending Source | Select-Object -Property EntryType, Source | ConvertTo-Html –pre Security_Errors| Out-File –append A:\SA.adm\EvtReports\EventReport.htm | |
Get-EventLog -LogName System -Newest 600 -EntryType Error | Sort-Object -Descending Source | Select-Object -Property EntryType, Source |ConvertTo-Html –pre System_Errors | Out-File –append A:\SA.adm\EvtReports\EventReport.htm | |
#Rename with current date. | |
$date = get-date -f yyMMdd | |
rename-item A:\SA.adm\EvtReports\EventReport.htm -newname ("EventReport_$date.htm") | |
############################################ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-EventLog -LogName Application -Newest 600 -EntryType Error | |
Get-EventLog -LogName Security -Newest 600 -EntryType FailureAudit | |
Get-EventLog -LogName System -Newest 600 -EntryType Error |