web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Power Automate and Pow...
Power Automate
Unanswered

Power Automate and Power Automate Desktop Powershell

(0) ShareShare
ReportReport
Posted on by 391

Hi Everyone

 

I am trying to automate onboarding tasks that uses both PA and PA Desktop.

 

The flow is working but it is not completed yet. I am trying to find out how do I use the PowerShell script in Power Automate Desktop to create an Exchange Office 365 mailbox based on the value on the Excel spreadsheet.

 

I tried to googling on how to write the scripts but to no avail. Can someone point me to the correct direction please?

 

Power Automate flow:

nicklim_2-1681637305022.png

 

nicklim_3-1681637327889.png

 

Power Automate Desktop flow:

nicklim_4-1681637702452.png

 

 

 

Categories:
  • Nived_Nambiar Profile Picture
    18,138 Super User 2026 Season 1 on at

    Hi @nicklim 

     

    For running powershell script via power automate desktop, use run powershell script action 

    Nived_Nambiar_0-1681653567387.png

     

     

    For powershell script, i found one sample code from ChatGPT 😅

    May be you can give a try 

     

     

    # Connect to Exchange Online or Exchange Server
    $UserCredential = Get-Credential
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
    Import-PSSession $Session
    
    # Set the mailbox parameters
    $Name = "John Smith"
    $EmailAddress = "john.smith@contoso.com"
    $Password = ConvertTo-SecureString "P@ssw0rd123" -AsPlainText -Force
    
    # Create the mailbox
    New-Mailbox -Name $Name -Alias $EmailAddress -UserPrincipalName $EmailAddress -Password $Password -ResetPasswordOnNextLogon $false
    
    # Disconnect from Exchange
    Remove-PSSession $Session

     

    Here for the place you need variables, you can replace that with variables from power automate 

     

    Let me know if you have any questions 🙂

    Mark it as solution if it resolves your query 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 231 Super User 2026 Season 2

#2
David_MA Profile Picture

David_MA 217 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 170

Last 30 days Overall leaderboard