Announcement: Future Cmdlet Deprecation | VMware PowerCLI Blog – VMware Blogs

inShare1

Announcement: Future Cmdlet Deprecation

Posted on November 25, 2014 by Brian Graf

1 Reply

As many of you saw our last post "Changes to Future PowerCLI Prerequisites" which discusses a few changes that will be occurring starting in our our next release, we also wanted to make you aware of a few cmdlets that we will be deprecating as of the next release.

Normally we don't give too many sneak peeks into future releases of PowerCLI. However, in order to provide our customers the maximum amount of time to update any scripts that may be affected by these changes and to help provide a smooth transition into the next release, we wanted to inform you all of these changes.

What will be Deprecated?

The following is a list of the cmdlets that will be deprecated as of our next release:

  • Get/Set-VMGuestNetworkInterface
  • Get/New/Remove-VMGuestRoute

In the PowerCLI documentation, these cmdlets have been noted as "…experimental and might be changed or removed in a future release. This cmdlet is not compatible with IPv6 environments."

As per previously in PowerCLI, you will understand that when a cmdlet is 'Deprecated', it is not removed immediately from our product. Rather, a yellow 'WARNING:' appears upon use of said cmdlet informing you that it has been deprecated and will be removed in a future release. The same will happen here until the cmdlets are finally removed in a future release.

![]6

Why are you doing this?

There are a couple of reasons. Initially these were created as experimental cmdlets. These cmdlets leverage scripts or "helper files" that are stored in the '\scripts\' folder within the PowerCLI install directory. Different "helper files" were needed for the different OS version's and, in the beginning, we were easily able to cover the main operating systems. Now as more and more operating systems are being run within our virtual environments and our customers require support for more and more operating systems, these helper files are needed to support all the variations of operating systems that are used.

We know how Community-driven PowerCLI is and how the community can often provide examples and solutions faster than our release cycle would let us, in this case we decided that the community was the best place for these scripts to be created and support. Instead, we have decided to leverage other powercmdlets that are already at our disposal.

In addition to the aforementioned, Microsoft has developed numerous cmdlets for modifying TCP/IP settings. This can be seen on Microsoft's website HERE. To avoid duplication of efforts and to allow our users to only have to learn a single set of commands, rather than a Windows way and PowerCLI way together, we have gone with leveraging the Microsoft TCP/IP Powershell cmdlets.

What does this mean for me?

If you are utilizing any of these cmdlets, you will want to begin updating your scripts that utilize these experimental cmdlets. As these cmdlets will be deprecated in next release, they will still be usable for a while longer. However, they will not be supported.

There are several other ways that these commands can be utilized.

How can I tell if I am using these cmdlets?

One easy way to find out if you are currently using these cmdlets in your scripts is of course to use PowerShell to search your scripts folder for scripts containing these cmdlets, this is easily achieved using the following example, as you can see from the output, it lists the filename, the line number, and the line of code being used:

Get-ChildItem -Include *.ps1 -Recurse | Select-String -Pattern Get-VMGuestNetworkInterface, Set-VMGuestNetworkInterface, Get-VMGuestRoute, New-VMGuestRoute, Remove-VMGuestRoute

Output:

PowerCLI\Set Network Interface of My VM.ps1:4:Set-VMGuestNetworkInterface -VMGuestNetworkInterface $vmGuestNetworkInterface -GuestUser User -GuestPassword Pass02 -Netmask 255.255.255.255 -Gateway 10.23.112.58

What can I do instead?

If you haven't had a chance to use the Invoke-VMscript cmdlet, you really should start now. It is a very powerful cmdlet that allows users to run scripts inside virtual machines. Invoke-VMscript requires a couple of parameters to run properly. Those are:

![]8

  • -VM (Name of the virtual machine we will be running commands on)
  • -GuestUser or –GU (User account that will be used to run the command)
  • -GuestPassword or –GP (User Password)
  • -Scripttext (This is the command that will be run on the remote machine, generally the script will be saved as a variable and placed here)
  • -Scripttype (There are three options here: PowerShell, Bat, Bash. If the –Scripttype parameter is not used in the invoke-vmscript command, it will default to, and assume, that the script is PowerShell. It is important that you choose the right language of the script)

That's it, so let's see how this works! (And remember, these can be either Windows or LInux VM's)

A) Change Network Settings for a Windows VM (equivalent of set-VMGuestNetworkInterface)

  • $IP = "10.144.99.80"
  • $Netmask = "255.255.255.0"
  • DefaultGW = "10.144.99.1"

$netsh = "c:\windows\system32\netsh.exe interface ip set address ""Local Area Connection"" static $ip $netmask $defaultgw 1″
Invoke-VMScript –VM "Test1-VCAC-IAAS" -guestuser "administrator" -guestpassword "VMware1!" -ScriptType bat -ScriptText $netsh

![]9

B) Change Network Settings on a Linux VM (Many ways to do this)

  • $IP = "10.144.99.81″
  • $num = "24″
  • $DefaultGW = "10.144.99.1″

$script = @"
echo STARTMODE=auto > /etc/sysconfig/network/ifcfg-eno16777728
echo BOOTPROTO=static >> /etc/sysconfig/network/ifcfg-eno16777728
echo IPADDR=$IP/$num >> /etc/sysconfig/network/ifcfg-eno16777728
echo default $DefaultGW — – > /etc/sysconfig/network/routes ; ifdown eno16777728 ; ifup eno16777728
"@
Invoke-VMScript -VM "TEST1-Linux" -GU root -GP vmware -ScriptText $script -ScriptType bash

C) Get the VM Guest Route (equivalent of Get-VMGuestRoute)

$script = "Route Print"

Invoke-VMscript –VM "Test1-VCAC-IAAS" –gu Administrator –gp VMware1! –scripttext $script

![]11

D) Set the VM Guest Route (equivalent of New-VMGuestRoute)

$script = "route add $destination mask $netmask $gateway"

Invoke-VMscript –VM "Test1-VCAC-IAAS" –gu Administrator –gp VMware1! –scripttext $script

![]12

E) Remove the VM Guest Route (equivalent of Remove-VMGuestRoute)

$destination = "127.0.0.1"

$script = "route delete $destination"

Invoke-VMscript –VM "Test1-VCAC-IAAS" –gu Administrator –gp VMware1! –scripttext $script

Conclusion

As you can see, the functionality from the deprecated cmdlets are still available today leveraging commands like invoke-vmscript and with the help of hte amazing community we will be able to utilize new ways of doing this and even more operating systems. If you have another way that you prefer to modify these settings on a guest VM, share it in the comment box below and look out for future repositories showing even more examples.

This entry was posted in Customization, General and tagged deprecate, PowerCLI, VMGuestNetworkInterface, VMGuestRoute on November 25, 2014 by Brian Graf.

About Brian Graf

Brian Graf is a Technical Marketing Engineer – Automation in the Cloud Infrastructure Technical Marketing group at VMware. Brian currently focuses on all of the vCloud Suite products as well as the Software-Defined Data Center. Previous to Technical Marketing, Brian worked as a Consultant for EMC Consulting. His main focus was Data center migration methodologies and implementations. His background previous to VMware includes Operations Engineering, Virtualization, Business Intelligence, and Exchange/Blackberry Engineering. Get notification of new blog postings and more by following Brian on Twitter: @vTagion

View all posts by Brian Graf →

How to get maximum returns from mutual funds? – Moneycontrol.com

How to get maximum returns from mutual funds? – Moneycontrol.com

Bull Run is continuing. Stocks are zooming and reaching new highs. Experts believe that markets would touch new peaks in coming months. Investors are in dilemma whether to continue investing or to book profits. Since one cannot predict stock market direction always, the best way is invest in mutual funds. A disciplined way of investing in mutual funds by considering a few factors would help you to get good returns.

How to get maximum returns from mutual funds?
1) Invest through SIP: Best way to invest in mutual funds is investing through SIP every month. Each small amount invested through mutual fund every month would create a good amount over a period of time. Do you know that Rs 5,000 per month invested through SIP in equity fund with an annualized returns of 12% can yield you Rs 25 Lakhs in 15 years.

2) Invest based on risk appetite: High risk appetite investors should go more towards equity funds, moderate risk appetite investors should be investing in hybrid funds (Equity + debt combination) and low risk appetite investors should be investing more in debt related funds. E.g. Reliance Small Cap fund, which is for high risk investors gave 140% returns in 1 year. This does not mean you would get such returns every year. But investing based on your risk style would help you to get high returns.

3) Invest in various categories of funds: Large cap, mid-cap and small-cap funds perform differently over a period of time in various market scenarios. Hence, investing in various categories of such funds would help you to get maximum returns. E.g. Franklin India Smaller companies fund focuses on potential small companies. This fund has outperformed and given 100% returns in last 1 year and annualized returns of 24% in last 5 years. Mid-cap funds may not provide such returns every year. But investing in such mid-cap fund would help you to get maximum return over a period of time.

4) Invest in sectors that are expected to outperform: There are high risk investors who are willing to take risks and invest in high risk funds like sector funds. Such investors can consider sectors that are likely to out-perform in the near future and invest in such funds. E.g. Infrastructure sector, though has reached some peak, is still expected to outperform in next 3 to 5 years. Considering Infra funds or banking funds (which would indirectly boost infra sector by way of funding) for short term to medium term of 3 to 5 years would be a best bet.

5) Invest in funds based on your financial goal: One of the area where investors fail to understand about mutual funds is they invest in wrong funds or misunderstand about the basic principle that they need to hold for the long term. Don't invest just because a mutual fund scheme has given 100% returns in one year. You should know that such fund could erode your capital if there is market crash. Invest in mutual funds based on your financial goal. E.g. You want to save money of Rs 30 Lakhs for your child foreign education in next 15 years. If you can invest Rs 6,000 per month in well diversified mutual fund portfolio for 15 years, you can easily achieve this goal. Hence, your investment should always be based on a pre-defined goal to achieve best results.

6) Use STP for lump sum mutual fund investments: One of the biggest mistake investor would do is investing a lump sum in equity funds. This may be a good strategy during market corrections. However, when markets are reaching peak or when you do not know its direction, the best way to invest a lump sum in mutual funds is invest in short term debt funds and do STP (Systematic Transfer Plan) to equity funds over a period of time. This is nothing but you are doing SIP to equity fund from debt fund thereby reducing risk of investing a lump sum in mutual fund.

Concluding remarks: Following these simple principles can help you to maximize returns in mutual funds. Stop waiting for market correction and start investing in mutual funds through SIP now.

The author of this article is founder of Myinvestmentideas.com. He can be reached at suresh@myinvestmentideas.com for any clarifications.