I've decided to create this dedicated page where I'll place "one line scripts". I sometimes use these one line commands to run reports on vSphere or SCVMM inventories, if I'm not permitted or able to run full length scripts in an environment.
On the 20th of February 2014, I published some of my PowerCLI scripts to GitHub in an attempt to have some sort of version control system in place as well as to make the scripts available to the general public. However, my current role doesn't really require that much scripting, and it really is only the occasional script that I have to put together. Therefore, I've only learned a little of PowerShell, basically enough to get the job done. I come from a C/C++ programming background and feel much more comfortable when working on a file with a .c, .cpp or a .h file extension.
Too many times now have I had to browse in a billion locations on my file systems, trying to find that one script that I wrote two or three years ago. I really have a bad habit of misfiling little scripts. That has got to change. So, I have started a little project to collect all of the PowerCLI scripts that I write and use from time to time, in a Git repository. I really needed to find a way of keeping scripts version controlled in a distributed system, whilst at the same time keeping them in a cloud based storage location other than simply Dropbox, where others can collaborate and add to it if they would wish to do so.
The repository is still very small, as I've only started working on it yesterday, however, as I write more and more scripts, I will be adding them to the repository and pushing them up to GitHub. There's no need to be able to use Git in order to make use of the scripts. Just download whatever you need and run them. However, feel free to contribute more scripts if you like.
Here is the URL to the repository: https://github.com/rynardtspies/ScriptKit
After updating my View environment to version 5.2, I noticed that my PowerCLI scripts that I run on the View Connection Server keep failing. After looking into the issue I found that each script execution fails when trying to load the snap-in for View PowerCLI into PowerShell with the following error:
"Add-PSSnapin : Cannot load Windows PowerShell snap-in VMware.View.Broker because of the following error: The Windows PowerShell snap-in module C:\Program Files\VMware\VMware View\Server\bin\PowershellServicesCmdlets.dll does not required Windows PowerShell snap-in strong name PowershellServiceCmdLets, Version=220.127.116.1115, Culture=neutral, PublicJeyToken=null"
To resolve the issue, the new PowershellServiceCmdlets.dll file installed during the View Connection Server update, needs to be registered with Windows PowerShell .
To register the file, open a new Windows PowerShell prompt and run the following script:
“C:\Program Files\VMware\VMware View\Server\Extras\PowerShell\add-snapin.ps1”