Powershell
Last edited September 8, 2007
More by halr9000 »
VMWare

VMWare Server Tasks to perform
 - obtain VM inventory
- change power status
- change config values
- add disks
- add memory
- take snapshots
- revert snapshots

Active Directory

Get-AdUser function 

Function Get-AdUser ($name) {
    (New-Object
System.DirectoryServices.DirectorySearcher("(&(CN=$name)(objectClass=User))")).findone().getdirectoryEntry()

}
WMI

Execute a process remotely using the Win32_Process WMI class
see http://groups.google.com/group/microsoft.public.windows.powershell/msg/95512b83367ab5b3

function Create-ProcessWithWMI ($computer = ".", $commandline = $(throw
"Enter the command to execute.") )
{
    $ProcessClass = get-wmiobject -query "SELECT * FROM Meta_Class WHERE
__Class = 'Win32_Process'" -namespace "root\cimv2" -computername $computer
    $results = $ProcessClass.Create( $commandline )

    if ($results.ReturnValue -eq 0) { $results.ProcessID }  # Or just return
$true if you don't want the PID.
    else { $false ; throw "Failed to create process!" }

}
Misc

Execute PS1 file from CMD 
 powershell -nologo -command "& {c:\scripts\myps.ps1}"
VI SDK powershell code so far:
[reflection.assembly]::loadfrom("$pwd\vimservice.dll")
$vimService = new-object vimService
$svcRef = new ManagedObjectReference
$svcRef.set_type("ServiceInstance")
$svcRef.set_value("ServiceInstance") 
ProgrammingGuide201.pdf (application/pdf Object)
www.vmware.com/pdf/ProgrammingGuide201.pdf
Instantiating an Instance and Opening a User
Session
   
VMTN Discussion Forums: how do i figure out the Web service ...
www.vmware.com/community/thread.jspa?messageID=600...
https://<address>/sdk/vimService?wsdl
https://<address>/sdk/vim?wsdl
This is the web service URL for a VI server (e.g. mojito)
The content on this page is provided by a Google Notebook user, and Google assumes no responsibility for this content.