Powershell – function to Query a SQL database
# Today’s quick and easy function is a simple one that I regularly use to query a SQL database. It will return an object containing the result of your query – so makes SQL access very simply from...
View ArticleUseful Function of the day – importing an Excel Spreadsheet to a Powershell...
Ever had to import a sheet from an Excel workbook . . and didn’t feel like saving as CSV . .or some other manual workaround? Drop the following function into your profile and you’re good to go . .
View ArticleScript of the Day – Powershell Menu Select list
Sometimes you’d like to prompt a user to select an option from a list in Powershell . . try this:
View ArticlePowershell – Script of the Day – Menu-Plus
Yesterday, we created a simple Powershell menu http://www.get-virtual.info/2011/01/26/script-of-the-day-powershell-menu-select-list/ Today’s script is a feeder for the menu, that allows you use any...
View ArticleScript of the day – ping a range of IP addresses
Friday today, so just a quick and easy script . . nothing clever In PowerShell, ping functionality can be handled by using the ‘test-connection’ cmdlet, or simply using .Net A ping using...
View ArticleScript of the day – writing to a cell in Excel
Ever needed to inject info to a cell in an Excel spreadsheet – repeatedly . . . you can do so from Powershell . . like so:
View ArticleScript of the Day – changing ESX NTP servers
The following script will amend the NTP server settings for all ESX hosts in your VC
View ArticleScript of the Day – import all VMs from a Datastore to VMWare ESX / ESXi
So your DC fell over . . but you have a copy of all your vmdks etc and would like to import them to a new ESX host . . The following script will run you through a series of prompt and then import all...
View ArticleScript of the Day – shutdown your VMware ESX estate with PowerCLI
The following script is straight from http://www.virtu-al.net/2010/01/06/powercli-shutdown-your-virtual-infrastructure/ I have used it a few times and it is very effective and easy to use. BE WARNED –...
View ArticleQuicker copies with Robocopy . .
So I was messing about with Robocopy over the weekend and I decided to re-run an old copy job, using a new Desktop. Strangely, my copy did not kick off like it did before. The problem – the new version...
View ArticleMonitoring VM Logs – Nearly real time monitoring – Script of the day
Today’s Script of the day is not one of my own, but one I have used a few times in the past few weeks – and I figured I should post here as a reminder for when I next need it. Written by the scripting...
View ArticleScript of the Day – Creating AD groups without QAD cmdlets
We’re automating some server builds and need to create AD groups to manage resource access to each Server (company policy) We use SCCM for deployment and I wanted to automate the groups (at build time)...
View ArticleScript of the Day – remove duplicate lines in a CSV file
Friday today, so we’ll keep it short and sweet. Someone dropped me a CSV file recently and asked if there was a quick way to remove duplicates. Easy . . Sample source file: Script: Pretty basic stuff,...
View ArticleScript of the Day – quick and easy VMware Powershell scripts
Today’s script of the day is more a collection of scripts (or rather an easy way of generating a bunch of scripts) Over at the VMware labs (http://labs.vmware.com/) they have released an awesome tool...
View ArticleScript of the Day – new(ish) Powercli cmdlets Get-ESXTop – part 1
Ignore this post – found it written up far better than I could ever manage: http://www.lucd.info/2010/12/03/hitchhikers-guide-to-get-esxtop-part-1/#more-2790 When I have some time, I’ll write a wrapper...
View ArticleScript of the day – testing if 2 IP addresses are on the same subnet
Ever needed to script around IP addressing issues on hosts and needed to determine whether 2 hosts are in fact on the same subnet or not? Try the following Function The code simply does a binary...
View ArticleScript of the day – Powercli one liner to get ESX host versions
So I was looking at an ESX estate that is managed by someone else and was hoping to do a few ‘Get-EsxCli’ queries. Of course Get-EsxCli only works properly from 4u2, so I needed to find a host that was...
View ArticleScript of the Day – Scripted start of Virtual Center (and supporting servers)...
There are many threads on the VM communities, debating whether it is better to run a VC on a physical host, or a VMWare host. My answer is always that running it as a VM is better, but the arguement...
View ArticleCopying data to/from a VM datastore using PowerCli – Script of the Day
Ever needed to copy data from your local machine to a VMware datastore . .and not felt like messing around with winSCP / FastSCP, the Datastore browser etc? PowerCli / PowerShell lets you create a new...
View ArticleIdentifying SAN disk usage using WMI – Powershell – Script of the Day
So I was commissioned with identifying the amount of actual disk space used by a bunch of Microsoft Servers that were attached to various SANs on our network. Unfortunately, despite us having a rather...
View Article