I dont have time to learn PowerShell…..

Rubbish !

I heard on one of the pod casts about this website so I thought I would blog about it for all of my sysadmin friends who claim they do not have time to learn PowerShell.

The important thing to remember is that if you follow these and start using PowerShell you will be saving time in the future, and believe me you will be saving alot of time.

The important thing to remember about PowerShell is that it isn’t only there for the scripts its also there for the simple commands that you don’t need to write massive scripts for.

For example if you need information about how much memory each server has and what domain it is in and what make the server is and you have the names in a text file then this simple one-liner can get that for you….

Get-Content C:\Servers.txt |Foreach-object {Get-WmiObject -class Win32_ComputerSystem –computername $_} | Format-Table Name, Domain, Model, TotalPhysicalMemory

Now think about how much time it would take you to rdp to each server and gather this information ?!?

Seriously, get learning…..

Learning Powershell in your lunch break Episode 1 – Getting Organized
Learning Powershell in your lunch break Episode 2 – Writing Scripts and Translating VBScript
Learning Powershell in your lunch break Episode 3 – Discovering objects (COM, WMI & ADSI)
Learning Powershell in your lunch break Episode 4 – Ins and Outs of the Windows Registry
Learning Powershell in your lunch break Episode 5 – Using WMI
Learning Powershell in your lunch break Episode 6 – ADSI Connecting to Domains/Computers and Binding Objects
Learning Powershell in your lunch break Episode 7 – Manage Users

I dare you to go through these and then not use PowerShell !

VI PowerScripter

Hal just pointed me to a new VI Client Plugin that integrates powershell into the VI Console, looks neat…

Download here

comasoft® VI PowerScripter (currently beta 1) is the first and absolutely unique VMware VI Client plug-in for a tight integration of user-defined PowerShell scripts into the object repository of VMware Virtual Infrastructure 3.5.

This plug-in delivers some predefined scripts for common admin tasks and is capable of handling hundreds of custom scripts for direct usage from a dynamically generated context menu within VI Client (for connections to VirtualCenter, ESX 3.5 or ESX 3i).

Thanks to its absolute flexibility, this powerful software is a “must” for professional users looking to administrate the virtual infrastructure in compliance with business-aligned functions in a simple and yet most effective manner.

Features

  • Load any VI PowerShell script through a dynamically created context menu (often no change needed)
  • Use of VM or Host based PowerShell scripts
  • Run Scripts against single or multiple chosen objects (also Cluster, DataCenter)
  • Switch between Debug and silent mode
  • Use local scripts or scripts from network shares
  • Enhance the VI Client or VirtualCenter functionality for your demands
  • PowerShell scripts using the correct VirtualCenter access rights
  • all script activities are logged
  • Usage of predefined scripts provided by icomasoft
  • Support for PowerGUI powerpack files

How to enable SSH on ESX 3i

This one has been around for a while but I thought I would document it on my blog as I just used it and there is a growing demand for 3i help due to it now being free !

How to enable SSH on VMware ESX 3i.

After reading the VMTN forum use the following steps to enable SSH

  • From the console press ALT-F1
  • Type unsupported and press ENTER
  • Enter the root password
  • Enter the following command vi /etc/inetd.conf
  • Search for the #SSH settings
  • Remove the # from the SSH row
  • Save the config by using :wq!
  • Type ps | grep inetd on the console
  • Send a hangup signal by using the following command kill -s HUP

You can now use Putty to SSH to your 3i server.

Free Powershell Book

Learn Microsoft Windows PowerShell one step at a time with practical,
hands-on instruction from Microsoft’s leading scripting trainer, Ed
Wilson.

Work at your own pace and build practical system administration
skills as you learn how to use Windows PowerShell to administer
Microsoft Windows, Microsoft Exchange, and other Microsoft technologies.

You will learn how to write your first Windows PowerShell commands and
scripts to automate setup, deployment, and administration.

Download here

Free VMbook – Business Continuity and Disaster Recovery

This Free VMware VMbook focuses on business continuity and disaster recovery (BCDR) and is intended to guide the reader through the step-by-step process to set-up a multisite VMware Infrastructure that is capable of supporting BCDR services for designated virtual machines at time of test or during an actual event that necessitated the declaration of a disaster, resulting in the activation of services in a designated BCDR site.

Downloadable here

Last minute entry…Its great !

A last minute entry has just come into the VMware PowerShell Comp and its very good….

This script will generate 2 .txt file reports based on your virtual environment.

The first report (report.txt) includes resource utilization across all Clusters including CPU and Memory usage for the cluster as a whole as well as each individual ESX host.
It will also list the VM to Host Ratio for the cluster.

The latter portion of the report includes an overview of total Datastore space allocated to the environment as well as space available and the amount of space used by powered off VMs.

The first report finishes off with a listing of all datastores with details on available space, capacity and % used.The second report is a hotlist (hotlist.txt which includes VM’s that are using, on average, more than 75% of their allocated memory.

It also includes hosts that are using more than 75% of their Memory or CPU.
It continues by listing datastores with less than 10% of their capacity available.
Finally it pulls WARNING messages from each ESX host’s VMKernel log since the beginning of the previous day.

The first report (report.txt) is designed to bring a high level view of the environment for reporting purposes as well as for making decisions on where additional resources may need to be allocated on a cluster level.
It is particularly useful for providing numbers up the chain of command without needing to pore through Virtual Center collecting data.

The second report is useful from a health check standpoint. It automatically identifies vm’s and hosts that are running hot to give an analyst an idea of where they may need to look into problems.

The datastore report is useful for determining ahead of time when additional storage needs to be allocated and where it should be used. Perhaps the most useful part of the report is the ESX logs. It’s a single place for analysts to watch for early signs of issues that may not be apparent when just using Virtual Center.

The script is a perfect item to run at the beginning of the day before heading down the hall to grab a cup of coffee.

Check it out here

VI Export Script – Whats next

I have had some great comments so far on my script, so I thought I would start thinking about the next version, let me know what you want.

So far…….

An Index page with linkable subjects to the following:

Index

Virtual Center

-> Cluster information

-> Resource Pool information

-> Snapshot information

-> Vlan Information

Esx Hosts

-> Host Information

-> Host Configuration

-> -> Hardware

-> -> Processor

-> -> Memory

-> -> Storage

-> -> Networking

-> -> Storage Adapters

-> -> Network adapters

Software

-> Licensed features

-> Time Configuration

-> DNS and Routing

-> Virtual Machine Startup/Shutdown

-> Virtual machine Swapfile Location

-> Security Profile

-> System resource Allocation

Virtual Machines

-> Vm information Client folder X (name,os,cpu,mem,disk,tools version,power,discr.)

-> Vm information Client folder Y name,os,cpu,mem,disk,tools version,power,discr.)

-> Vm information Client folder Z (name,os,cpu,mem,disk,tools version,power,discr.)

Datastores

-> Datastore information

Options to run the script:

Report.ps1 virtalcenterserver /All

Report.ps1 virtalcenterserver /only VC and ESX Host configuration

Report.ps1 virtalcenterserver /only vms in map X

Thanks to Greetz for the ideas.

Virtualise in Minutes with VMware ESXi

Now its free why not give it a go with help from this new podcast from VMware…

VMware ESXi is the leanest, meanest hypervisor on the market today.

Discover the benefits of VMware virtualisation by learning how to get started in four easy installation steps.

Speakers:
John Gilmartin, Group Product Manager, Product Marketing, VMware Amir Sharif, Sr. Product Manager, Product Marketing, VMware

Listen: Listen or Download MP3 * (7 MB 10:15 mins)

Check Active Directory Latency Script

Here is a neat Powershell script that:

  • Finds all Domain Controllers in the Domain (using .NET)
  • Creates a contact object in a specified OU (Default is users container for the Domain)
  • Gets the start Time
  • Loops and Checks each DC for the object.
  • Once all DCs have the object it gets End Time
  • Outputs the results

Basically you can check how long it takes to replicate to each of your sites. Very Usefull !

Bigup Myself !

Im starting to get famous, very slowly my plan to virtualise the world is coming together (as I once said.. Virtualise the world, Virtualise the cheerleader)

My script which exports configuration information from Virtual Center straight into MS Word has now been used by a fair few poeple and it seems to be working, which is good as I couldnt give it the testing I would have liked to.

1. A few people in the forum have been using it and comments are good …..link here

2. I had an email from someone who used it against there system running it over a VPN connection to the VI Server with over 20 ESX servers and over 250 VM’s, the script produced a 1.56 MB which has 50 pages. large scale testing !!!

3. I had a mention in the get-scripting podcast (I havnt sync’d my zune yet but will listen when I get home today), thanks Jonathan.