#! perl -w use strict; use Win32::OLE; use Win32::OLE::Enum; Win32::OLE->Option(Warn => 3); my $hostname = shift; my $rootkey = shift; my $Collection = Win32::OLE->GetObject("IIS://$hostname/w3svc"); my $virts = Win32::OLE::Enum->new($Collection); my @vhosts = $virts->All; foreach (@vhosts){ print "$_\n"; }