The SnapIn: Updates and future?

PowerShell script exchange

The SnapIn: Updates and future?

Veeam Logoby fwn » Fri May 26, 2017 3:24 pm

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
fwn
Lurker
 
Posts: 1
Liked: never
Joined: Fri May 26, 2017 3:07 pm
Full Name: Friedrich Weinmann

Re: The SnapIn: Updates and future?

Veeam Logoby zuldan » Sat May 27, 2017 11:15 am

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!
zuldan
Enthusiast
 
Posts: 44
Liked: 5 times
Joined: Wed Feb 15, 2017 9:51 am

Re: The SnapIn: Updates and future?

Veeam Logoby twesterd » Sun May 28, 2017 2:27 am

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&lt;CObjectInJob&gt; 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;
twesterd
Influencer
 
Posts: 17
Liked: never
Joined: Wed May 17, 2017 7:38 pm
Full Name: Trevor W

Re: The SnapIn: Updates and future?

Veeam Logoby v.Eremin » Wed May 31, 2017 3:13 pm

We have this request tracked. However, currently I cannot provide any comments regarding a time when it will be implemented. Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: Exabot [Bot] and 4 guests