Sign in
|
Join PowerShell.com!
|
Help
Home
PowerTips
Ask the Experts
Forums
Webcasts
Blogs
eBookV2
Script Library
Twitter Grid
Modules
QuickClick
Scripts
Snippets
Videos
Library
»
Script Library
»
VMware
»
ConnectVI-Server
ConnectVI-Server
Share
|
Browse Library
Module Library
QuickClick Library
Script Library
Active Directory
BizTalk
Citrix
Clustering
Desktop
Exchange Server 2003
Exchange Server 2007
File System
Group Policy
Internet Information Server (IIS)
Local Accounts
Logs
Microsoft Office
Microsoft Team Foundation Server
MySQL
Networking
Registry
Remote Desktop Services
Remoting
Security
SharePoint
SQL Server
System Center Virtual Machine Manager
System Center Configuration Manager
System Center Operations Manager
Tutorial
Terminal Server
Using .Net
Virtual Server
VMware
Windows 7
Windows HPC
Windows Server 2000
Windows Server 2003
Windows Server 2008
Windows XP
WMI
Misc
Snippet Library
Video Library
Members Only
Tags
Clone
Compare Clusters
Connect
Datastores
Disconnect
Disk Usage
Get-Stat
Guests
Healthcheck
Host Models
Host Version
Hosts
Load Balance
LUN
Measure-Object
Monitor
Snapshot Count
Thin-Provisioned
VI Toolkit
Virtual Disks
VM
VM List
VM's details of Data Center
VMware
vNIC
View more
Previous
|
Next
|
View all files
|
View Slideshow
Download
posted by
Richard Giles
10-06-2008
Downloads: 387
File size: 1.6kB
Views: 1,480
Embed
ConnectVI-Server
## =====================================================================
## Title
: ConnectVI-Server
## Description : Connects to the VI server.
## Author
: Idera
## Date
: 9/11/2008
## Input
: -VIserver : Virtual Infrastructure server
##
-verbose
##
-debug
## Output
:
## Usage
: EXAMPLE 1: PS> ./ConnectVI-Server myVIserver
-v -d
Connects to VI server named myVIserver.
## Notes
:
## Tag
: PowerShell, VMware
## =====================================================================
param
(
[
string
]
$VIserver
,
[
switch
]
$verbose
,
[
switch
]
$debug
)
function
main()
{
if
(
$verbose
) {
$VerbosePreference
=
"Continue"
}
if
(
$debug
) {
$DebugPreference
=
"Continue"
}
ConnectVI-Server
$VIserver
}
function
ConnectVI-Server
([
string
]
$VIserver
=
""
)
{
## Clear Screen.
Clear-Host
## Warn user they must be logged on with an account that has connection rights to the VI server.
$answer
=
Read-Host
"`n`n`n`tNOTE: You must be logged on with an account that has connection rights to the VI server. Press <X> to exit or <Enter> to continue. "
if
(
$answer
-eq
"x"
)
{
break
}
else
{
if
(
$VIserver
-eq
""
)
{
Write-Host
"`n`n`n`tERROR- A VI server must be specified!`n`n"
-foregroundcolor
red
break
}
else
{
Connect-VIServer
$VIserver
Write-Host
"`n`n`t You have connected to Server: $VIserver.Name with a SessionID of: $VIserver.SessionID ."
Read-Host
"`n`t Press <Enter> to continue "
}
}
}
## EOF: ConnectVI-Server()
## Run Main
main
Filed under:
Connect
,
VMware
,
VI Toolkit
Connects to a VMware Infrastructure Server using the VMware VI Tools PowerShell snapin.
Copyright 2011 PowerShell.com. All rights reserved.