Question

To to create a powershell script that will send a email when text file is empty

To to create a powershell script that will send a email when text file is empty
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Script

If ((Get-Content "Filename.txt") -eq $Null) {    //to check whether the file is empty
  Send-MailMessage -To <> -From <> -Subject "" -Attachments "" -SmtpServer <>    //Send the mail
}

where <> represents the placeholders which can be replaced with the appropriate content.

Add a comment
Know the answer?
Add Answer to:
To to create a powershell script that will send a email when text file is empty
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • powershell Need a Powershell Script check through different CSV sheets and can send out an email alert when an CSV...

    powershell Need a Powershell Script check through different CSV sheets and can send out an email alert when an CSV shet is empty Need a Powershell Script check through different CSV sheets and can send out an email alert when an CSV shet is empty

  • powershell For example a link “\\example\temp\chg” goes to a file that contains multiple Excel CSV files such as “...

    powershell For example a link “\\example\temp\chg” goes to a file that contains multiple Excel CSV files such as “chg.csv” Chg.csv and the multiple other Excel Csv files contain data under Name, Date, Address If the Excel CSV file only contains the header Name, Date, Address then send an email alert from a powerscript file that the Excel Csv file is empty Need a Powershell script that will obtain a path thats leads to multiple comma separated value excel sheets and...

  • Create the PowerShell script using NotePad (or use the PowerShell ISE). The PowerShell script is a...

    Create the PowerShell script using NotePad (or use the PowerShell ISE). The PowerShell script is a very simple one that simply prints the line: “Today is: “ followed on the next line by the actual date and time when the script is executed. (Major hint: use the cmdlet get-date.) 'Today is' going to bed red,while the date and time is going to be green. Name your script: get-daymessage.ps1. Name your task: displayDate.

  • Can someone help me create a script in PowerShell along with a csv file for 5...

    Can someone help me create a script in PowerShell along with a csv file for 5 users. I will really appreciate. Please explain in step by step because i am new to this. the csv should contain 5 user. i want to create 5 users .

  • Powershell Script

    Create a powershell script that will prompt user to enter the following information:Please choose your selection:1. Enter Grade Information2. Write File3. ExitIf user choose 1) then the script should ask the user for their course number (ex. ABC-123), course name and letter grade received.If user choose 2) then the script should generate a CSV file to save all dataIf user choose 3) the script should stop

  • Create a powershell script to create a user named: Week10User (provide whatever other details that may...

    Create a powershell script to create a user named: Week10User (provide whatever other details that may be required to create the user.) II. Create a script to create a group named: Week10Group III. Create a script to add the user Week10User into the Week10Group. IV. Create a script to create an organizational unit named: Week10OU V. Create a script to delete the user Week10User from the group named Week10Group. VI. Create a script to add a user named Week10User into...

  • Create a powershell script to create a user named: Week10User (provide whatever other details that may...

    Create a powershell script to create a user named: Week10User (provide whatever other details that may be required to create the user.) II. Create a script to create a group named: Week10Group III. Create a script to add the user Week10User into the Week10Group. IV. Create a script to create an organizational unit named: Week10OU V. Create a script to delete the user Week10User from the group named Week10Group. VI. Create a script to add a user named Week10User into...

  • 4. Using Technique 1 from the text book, write the PowerShell script that will create a...

    4. Using Technique 1 from the text book, write the PowerShell script that will create a custom object named Q4 with the properties and values as indicated in the below table. The last line in your script should output the object to the screen. Property Name FirstName LastName ProcessName Property Value Your first name Your last name The name of the first process running on your VM. You should use Get-Process in your script to retrieve this name. The ID...

  • Need help with writing a Windows PowerShell script that will perform the following functions: Sea...

    Need help with writing a Windows PowerShell script that will perform the following functions: Search your computer for files ending with a .doc, .docx, .xls, or .xlsx file extension. Output the filenames and sizes (in groups by file extension) to a text file named “File_Summary.txt”. The output should also conclude with a total of the number of files and total file size for each file extension. Include comments in the script code to document the functionality of the script. I...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT