How to upgrade powershell version

Hi Folks,
 
Sometimes we are trying to execute some types of powerShell scripts, but powerShell don't support them.
 
Mostly, this type of issue is occured , when PowerShell version is not updated/ use old versions.
 
Here, we are done, how to upgrade the PowerShell.
  1. clear-host    
  2. Clear-History    
  3.     
  4. $wshell = New-Object -ComObject Wscript.Shell    
  5. $a=Get-Host    
  6. $a.Version.Major    
  7.     
  8. if($a.Version.Major -lt 3)    
  9. {    
  10.     Write-Host "Powershell Version is" $a.Version.Major -fore Yellow       
  11.     $a= $wshell.Popup("Powershell Version Mismatch, We are proceeding with the next step",0,"Powershell Version Mismatch")    
  12.         
  13.     if($a.Equals(1))    
  14.     {    
  15.         $a= $wshell.Popup("Do u want to upgrade your powershell script and after that you need to restart the system for applying all the changes.",0,"Message",0x1)    
  16.         if($a.Equals(1))    
  17.         {    
  18.             Write-Host "test" -fore Red                
  19.         }    
  20.     }        
  21. }    
  22. else    
  23. {    
  24.     write-host "test" -fore Red    
  25.     $wshell.Popup("Authentication failed - please verify your username and password.",0,"Done")    
  26. }    
After that powershell will be updated, then try to use your not ran script.