PowerShell script exchange
Post Reply
ri_joe
Influencer
Posts: 10
Liked: never
Joined: May 02, 2019 8:28 am
Contact:

How to connect to the Remote PowerShell instance on the VEEAM server via C#

Post by ri_joe »

Hi All, I am new to VEEAM, I have a requirement that need to restore Exchange mailbox items remotely.

Currently, I have a C# module that can connect to Exchange server to run EX related powershell. Below is sample code to create the runspace

Code: Select all

var connectionInfo = new WSManConnectionInfo();
connectionInfo.Credential = new PSCredential(UserName, Password);
connectionInfo.ComputerName = ServerName;
connectionInfo.ConnectionUri = new Uri("https://" + ServerName + "/powershell");
connectionInfo.ShellUri = "Microsoft.Exchange";
connectionInfo.AuthenticationMechanism = AuthenticationMechanism.Basic;

Runspace rs = RunspaceFactory.CreateRunspace(connectionInfo);
rs.Open()
Can anyone tell me what's the equivalent value of ComputerName/ConnectionUri/ShellUri/AuthenticationMechanism ? Or VEEAM is using another approach for remote powershell?

Thanks
Dima P.
Product Manager
Posts: 14417
Liked: 1576 times
Joined: Feb 04, 2013 2:07 pm
Full Name: Dmitry Popov
Location: Prague
Contact:

Re: How to connect to the Remote PowerShell instance on the VEEAM server via C#

Post by Dima P. »

Hello ri_joe,

Mind me asking, have you tried to use Enterprise Manager to provide Exchange restore items self service restore capabilities? In addition to built-in functionality Enterprise Manager provides Veeam Backup Enterprise Manager RESTful API for the integration purposes. Cheers!
ri_joe
Influencer
Posts: 10
Liked: never
Joined: May 02, 2019 8:28 am
Contact:

Re: How to connect to the Remote PowerShell instance on the VEEAM server via C#

Post by ri_joe »

Hi Dima,

Thanks for your info. But because the system already have an admin portal, customers want to perform the restoration via that portal site instead of VEEAM EM.

About the RESTful API, I have consulted with the local VEEAM vendor, and they reply that only VEEAM powershell can fulfill the requirement below:
Restore one single or multiple email items from archives with certain searching criteria to a specific folder (for example: Restore Mail) of user's current mailbox.
Is it true?
Dima P.
Product Manager
Posts: 14417
Liked: 1576 times
Joined: Feb 04, 2013 2:07 pm
Full Name: Dmitry Popov
Location: Prague
Contact:

Re: How to connect to the Remote PowerShell instance on the VEEAM server via C#

Post by Dima P. »

That's correct. Veeam Explorers PowerShell Reference contains all the known PowerShell cmdlet, so I hope you will find it helpful. Cheers!
Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests