PowerShell script exchange
Post Reply
fwn
Lurker
Posts: 1
Liked: never
Joined: May 26, 2017 3:07 pm
Full Name: Friedrich Weinmann
Contact:

The SnapIn: Updates and future?

Post by fwn »

Hi guys,

I just had an ... interesting issue:
I wanted to install the PowerShell Snapin (and only that) on my administrative notebook, in order to manage the Veeam installations at whatever customer's site I happen to work with.
Well ... turns out, that's not quite so easy:
- There is no separate installer - I had to take it from the latest installation media available (9.5 Update 1)
- The Snapin refuses to connect to an up-level server, so I had to update it. That's cool with me, but there is no update for the PSSnapIn. I had to run the full B&R Update 2, which updated the snapin and installed a few services and components that really have no business being on my machine.
Is there any simpler way of actually getting the PowerShell tools?

Future plans
The Veeam PowerShell tools come as a SnapIn. Those were deprecated when PowerShell v2 was released (That ... wasn't exactly yesterday) in favor of modules that require no installation, can be flexibly imported and exported.
That can be published via the PowerShell Gallery.
The benefits are manyfold, the disadvantages of the current system annoying.
Is there any hope of the Veeam PowerShell SnapIn to be transformed into a module?
Even VMware managed the step.

Cheers,
Fred
zuldan
Enthusiast
Posts: 45
Liked: 5 times
Joined: Feb 15, 2017 9:51 am
Contact:

Re: The SnapIn: Updates and future?

Post by zuldan »

I would also like to know if there are any plans to move Veeam cmdlets from SnapIn to Module. Being able to install the Veeam module to any machine from the Powershell Gallery would be really powerful. Veeam developers updating their Powershell cmdlets via Powershell Gallery outside of the normal release cycle would be awesome.

I'd like to point out, having the sticky post "No snap-ins have been registered for Windows PowerShell version" speaks for itself. Having module based cmdlets would prevent many support calls / posts.

VMware PowerCLI has just moved to Powershell Gallery. Veeam it's your turn!
twesterd
Influencer
Posts: 17
Liked: 3 times
Joined: May 17, 2017 7:38 pm
Full Name: Trevor W
Contact:

Re: The SnapIn: Updates and future?

Post by twesterd »

I also support switching over to modules and dropping the requirement to install the Veeam console. Would also like the appropriate dlls provided (I.e. veeam.backup.core, veeam.backup.common, veeam.backup.model). I use Visual Studio and PowerShell and modules would be able to be posted/published in Nuget where the whole thing could be auto-installed into a Visual Studio project.

As others have noted, VMware has already done this.

This is a sample of my code:

Code: Select all

        /// <summary>
        /// Gets all VMs contained in backup job.
        /// </summary>
        /// <returns>Returns a list of <see cref="Veeam.Backup.Core.CObjectInJob"/> object instances.</returns>
        /// <example>Example usage:<code language = "cs" >
        /// Actions actions = new Actions(); 
        /// List<CObjectInJob> vmList = actions.GetJobVMs("Backup some_virtual_machine job");</code></example>
        public List<CObjectInJob> GetJobVms(string jobName)
        {
            if (isDebugEnabled)
                log.DebugFormat("Received request to retrieve all VMs witin Job: {0}", jobName);

            PowerShell shell = GetShell();

            shell.AddStatement().AddCommand("Get-VBRJob")
                .AddParameter("Name", jobName);
            shell.AddCommand("Get-VBRJobObject");

            List<CObjectInJob> vmList = new List<CObjectInJob>();
            try
            {
                if (isDebugEnabled)
                    log.Debug("Invoking PowerShell to retrieve VMs from job");

                Collection<PSObject> jobs = shell.Invoke();
                if (jobs != null && jobs.Count > 0)
                {
                    if (isDebugEnabled)
                        log.Debug("Veeam returned collection of VMs.");
                    foreach (var outputItem in jobs)
                    {
                        CObjectInJob vm = (CObjectInJob)outputItem.BaseObject;
                        if (isDebugEnabled)
                            log.DebugFormat("Adding VM, Name: {0} to VM list.", vm.Name);
                        vmList.Add(vm);
                    }
                } else
                {
                    log.DebugFormat("Failed to retrieve VMs from Veeam server for Back Job: {0}.", jobName);
                }
            }
            catch (Exception ex)
            {
                log.FatalFormat("Failed to retrieve VMs for Back Job: {0} from Veeam server.", jobName, ex);
            } finally
            {
                shell.Dispose();
            }
            if (isDebugEnabled && vmList.Count <= 0)
                log.DebugFormat("Veeam server did not return any VMs for Job, Name: {0}. Returning empty list", jobName);
            return vmList;
        }
Notice below the ability to cast because the dlls are referenced (see highlighted section of code below)

Code: Select all

CObjectInJob vm = (CObjectInJob)outputItem.BaseObject;
veremin
Product Manager
Posts: 20284
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: The SnapIn: Updates and future?

Post by veremin »

We have this request tracked. However, currently I cannot provide any comments regarding a time when it will be implemented. Thanks.
evilaedmin
Expert
Posts: 176
Liked: 30 times
Joined: Jul 26, 2018 8:04 pm
Full Name: Eugene V
Contact:

Re: The SnapIn: Updates and future?

Post by evilaedmin »

Hello Vladimir,

With Powershell 7 being marketed as the successor to both powershell core (cross platform) and Windows Powershell 5.1 (when used on Windows Server), are there any plans to support at least the Powershell 7-On-Windows Server use case? This hypothetically opens up an opportunity for PS remoting over SSH from a cross-platform PS client to Veeam VBR on Windows Server?
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: The SnapIn: Updates and future?

Post by oleg.feoktistov » 2 people like this post

Hi Eugene,

We are fully aware of Powershell 7 and currently looking into compatibility in question. However, we cannot advise on estimated implementation time just yet.

Best regards,
Oleg
Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests