Solved

Need to identify the Serial port which are enbled on VM at single shot

Posted on 2010-09-15
7
643 Views
Last Modified: 2012-05-10
HI Experts,

I have got request to remove the Serial port on Virtual machin, Actually we have around 350 VM most of the VM's are enabled Serial port some of them are not enabled, so how do we find which are the Vm's  have serial port enable and how do we remove at one shot.

Many Thanks,
Vijay.
0
Comment
Question by:mail2vijay1982
  • 4
  • 3
7 Comments
 
LVL 22

Accepted Solution

by:
Luciano Patrão earned 500 total points
ID: 33684232
Hi

Hope this can help you

I think this script can show you the information that you need

Also you can try to use vminfo.pl from vSphere SDK to extract this values

Hope this can help you

Jail
#########################################################################################
# The script lists information about CD-ROM, Floppy, Parallel Ports and Seriel Ports   	#
#  										      									       	#
# Created by: Anders Mikkelsen, 2009			 	     	                     		#
#########################################################################################
Add-PSSnapin VMware.VimAutomation.Core

$server = "VIServerName or IP"
$user = "UserName"
$pwd = "Password"

Connect-VIServer $server -User $user -Password $pwd

$vms = Get-VM
write "VM's with CD-ROM 'Connected' :"
foreach ($vm in $vms | where { $_ | Get-CDDrive | where { $_.ConnectionState.Connected -eq "true"}}) {
	write $vm.name
}
write "`nVM's with CD-ROM set to 'Connect at power on' :"
foreach ($vm in $vms | where { $_ | Get-CDDrive | where { $_.ConnectionState.StartConnected -eq "true"}}) {
	write $vm.name
}

write "`nVM's with CD-ROM device type set to 'Client Device' :"
foreach ($vm in $vms | where { $_ | Get-CDDrive | where { $_.RemoteDevice.Length -ge 0}}) {
	write $vm.name
}

write "`nVM's with CD-ROM device type set to 'Datastore ISO file' :"
foreach ($vm in $vms | where { $_ | Get-CDDrive | where { $_.ISOPath -like "*.ISO*"}}) {
	write $vm.name
}

write "`nVM's with Floppy 'Connected' :"
foreach ($vm in $vms | where { $_ | Get-FloppyDrive | where { $_.ConnectionState.Connected -eq "true"}}) {
	write $vm.name
}

write "`nVM's with Floppy 'Connect at power on' :"
foreach ($vm in $vms | where { $_ | Get-FloppyDrive | where { $_.ConnectionState.StartConnected -eq "true"}}) {
	write $vm.name
}

write "`nVM's with Floppy device type set to 'Client Device' :"
foreach ($vm in $vms | where { $_ | Get-FloppyDrive | where { $_.RemoteDevice.Length -ge 0}}) {
	write $vm.name
}

write "`nVM's with Floppy device type set to 'Use excisting floppy image in datastore' :"
foreach ($vm in $vms | where { $_ | Get-FloppyDrive | where { $_.FloppyImagePath -like "*.FLP*"}}) {
	write $vm.name
}

write "`nVM's with Serial Ports attached :"
$vms | Get-View | %{
  foreach($dev in $_.Config.Hardware.Device){
    if($dev.DeviceInfo.Label -like "Serial Port*"){
	  foreach($tmp in $dev.Connectable){
	    write $_.Name 
	    #write $tmp
	  }
    }
  }
}

write "`nVM's with Parallel Ports attached :"
$vms | Get-View | %{
  foreach($dev in $_.Config.Hardware.Device){
    if($dev.DeviceInfo.Label -like "Parallel Port*"){
	  foreach($tmp in $dev.Connectable){
	    write $_.Name 
	    #write $tmp
	  }
    }
  }
}

Open in new window

0
 
LVL 4

Author Comment

by:mail2vijay1982
ID: 33689967
HI

this script is descried only one Vm, we can check cd-rom,serial port,etc, But How can i find the 350 Vms at the same time.
0
 
LVL 22

Expert Comment

by:Luciano Patrão
ID: 33690709
Hi

No. You need to connect this scrip to your vCenter, or ESX host.

Also if you use the vminfo.pl, you need to connect to the vCenter or ESX host.

Of course you need to change the Script and add your vCenter credentials

$server = "VIServerName or IP"
$user = "UserName"
$pwd = "Password"

Jail
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 4

Author Comment

by:mail2vijay1982
ID: 33692686
HI BestWay,

Thanks for the replay,

My question is how do we find the serial port for 300 Vms,This script is for finding serial port for only one Vm, not for 300 Vm.
0
 
LVL 22

Expert Comment

by:Luciano Patrão
ID: 33692982
Hi

This script will run on the vCenter configuration(this is why you need to connect to the vCenter with the script) and will check all the VMs inside of that vCenter one by one and give you the information for all the VMs

You need to add you vCenter information like i show in my last message. Change the script(that 3 options) with your configuration. servername or IP, user and password to connect to vCenter)

Jail
0
 
LVL 22

Expert Comment

by:Luciano Patrão
ID: 33697058
Hi

Now i have some time and tested the script, and this what i get when run the script on a vCenter LAB that i have.

As you can see, it scans all the VMs to check, CD-ROM, ISO Datastore, Floppy, Parallel Port, Serial Port, etc., then shows what VMs are using each of this settings.

With this you can get all the information that you need.

So like i said, you need to change the script and add your vCenter or ESC host IP, user and password, and run this on the Powershell console(or PowerGui Editor).

Jail


Name                                         Port                                         User                                       
----                                         ----                                         ----                                       
192.168.1.40                                 443                                          administrator                              
VM's with CD-ROM 'Connected' :

VM's with CD-ROM set to 'Connect at power on' :
ESX 4.1.0-260247
VM Brightstor
vSphere Management Assistant
ESX 4.0.0-164009
ESX 4.0.0-u1-208167
VM Linux Oracle
VM XP Pessoal
VM Exchange 2007
VM DC 2008 Lab
VM ORACLE
VM HYPERION

VM's with CD-ROM device type set to 'Client Device' :
VM Win 7 Pro
VM LAB
VM Testing ISA
vCenter Lab Hosts
VM Clone
VM DC

VM's with CD-ROM device type set to 'Datastore ISO file' :
ESX 4.1.0-260247
VM DC Lab
VM Brightstor
ESX 4.0.0-164009
ESX 4.0.0-u1-208167
VM Linux Oracle
VM Exchange 2007
VM DC 2008 Lab
VM ORACLE
VM HYPERION

VM's with Floppy 'Connected' :

VM's with Floppy 'Connect at power on' :

VM's with Floppy device type set to 'Client Device' :

VM's with Floppy device type set to 'Use existing floppy image in datastore' :

VM's with Serial Ports attached :

VM's with Parallel Ports attached :

Open in new window

0
 
LVL 4

Author Closing Comment

by:mail2vijay1982
ID: 33699879
Good answer
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

This article will show you how to create an ISO CD-ROM/DVD-ROM image (*.iso), and MD5 checksum signature, for use with VMware vSphere Hypervisor 6.5 (ESXi 6.5). It's a good idea to compare checksums, because many installations fail because of a corr…
In this step by step tutorial with screenshots, we will show you HOW TO: Enable SSH Remote Access on a VMware vSphere Hypervisor 6.5 (ESXi 6.5). This is important if you need to enable SSH remote access for additional troubleshooting of the ESXi hos…
Teach the user how to join ESXi hosts to Active Directory domains Open vSphere Client: Join ESXi host to AD domain: Verify ESXi computer account in AD: Configure permissions for domain user in ESXi: Test domain user login to ESXi host:
This Micro Tutorial steps you through the configuration steps to configure your ESXi host Management Network settings and test the management network, ensure the host is recognized by the DNS Server, configure a new password, and the troubleshooting…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now