I came across this article: http://blogs.vmware.com/vipowershell/2011/06/how-to-speed-up-the-execution-of-the-first-powercli-cmdlet.html and decided to test the steps out myself:
[cc lang=”dos”]
REM View the following link for details: http://blogs.vmware.com/vipowershell/2011/06/how-to-speed-up-the-execution-of-the-first-powercli-cmdlet.html
C:\Windows\Microsoft.NET\Framework\v2.0.50727\ngen.exe install “VimService41.XmlSerializers, Version=4.1.0.0, Culture=neutral, PublicKeyToken=10980b081e887e9f”
C:\Windows\Microsoft.NET\Framework\v2.0.50727\ngen.exe install “VimService40.XmlSerializers, Version=4.0.0.0, Culture=neutral, PublicKeyToken=10980b081e887e9f”
C:\Windows\Microsoft.NET\Framework\v2.0.50727\ngen.exe install “VimService25.XmlSerializers, Version=2.5.0.0, Culture=neutral, PublicKeyToken=10980b081e887e9f”
REM If you are running on 64-bit OS, you need to run the following as well:
if %PROCESSOR_ARCHITECTURE% == AMD64 (
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\ngen.exe install “VimService41.XmlSerializers, Version=4.1.0.0, Culture=neutral, PublicKeyToken=10980b081e887e9f”
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\ngen.exe install “VimService40.XmlSerializers, Version=4.0.0.0, Culture=neutral, PublicKeyToken=10980b081e887e9f”
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\ngen.exe install “VimService25.XmlSerializers, Version=2.5.0.0, Culture=neutral, PublicKeyToken=10980b081e887e9f”
)
[/cc]
Running the NGEN.EXE commands made my connect-viserver cmdlet run a bit faster…it now takes 8 seconds the first time instead of 12. Not much savings, but if I had time to waste I wouldn’t be using PowerCLI in the first place!
