Forum Discussion

Manas0396's avatar
Manas0396
Frequent Visitor
3 months ago
Solved

Create Power BI Gateway restart Automation script by power shell

Hi Team, can you please help me how to create an automation script by using powershell so that it will check in every 5minutes if my gateway is online it is fine if offline start it and send an email...
  • DataVitalizer's avatar
    DataVitalizer
    3 months ago

    Happy to help clarify.


    From address => This is just the sender name that appears in the email, it doesn't have to be a real mailbox, but it should look professional, just replace [email protected] with your actual company domain, something like [email protected] you can think of it like a "no-reply" email address.

     

    To address => You already have this right, just put your admin group email [email protected] there and everyone in that group will receive the alert.

     

    SMTP & Port => Since you're on Office 365, keep smtp.office365.com and port 587 as they are, these are Microsoft's default settings for sending emails securely, nothing to change here.

     

    Credentials => Use your admin account that has an Office 365 mailbox and to avoid the script asking for your password every time it runs, do this once:

    Get-Credential | Export-Clixml -Path "C:\Scripts\gateway-cred.xml"

    Then swap (Get-Credential) in the script with:

    Import-Clixml -Path "C:\Scripts\gateway-cred.xml"

     

    You would not need Azure App Registration at all for this setup.

     

    Did it work? 👍 A kudos would be appreciated
    🟨 Mark it as a solution to help spread knowledge 💡

     

    🟩 Let's connect on LinkedIn