Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Problem with convert from WSH-script

Reply
 
Old 02-19-2008   #1 (permalink)
David Kriz


 
 

Problem with convert from WSH-script

Please, can you help me with this problem?

I am converting this script from WSH :
_____________________________________________
/ \
VirtualComputerNameS = "Windows 2000 Server"

Set objVS = CreateObject("VirtualServer.Application")
Set objVM = objVS.FindVirtualMachine(VirtualComputerNameS)

Set objGuestOS = objVM.GuestOS
objGuestOS.Shutdown()
\_____________________________________________/

to PowerShell :
_____________________________________________
/ \
$VirtComputerNameS = "Windows 2000 Server"

$VirtServerO = new-object -com VirtualServer.Application
\_____________________________________________/
..

I don't know, how to convert 4. and 6. line ( Set objVM =
objVS.FindVirtualMachine(VirtualComputerNameS) and Set objGuestOS =
objVM.GuestOS ) ?

My System SpecsSystem Spec
Old 02-19-2008   #2 (permalink)
Shay Levi


 
 

Re: Problem with convert from WSH-script

Best way is to pipe $VirtServerO to get-member. It will show you what methods
are available.

Here's a wild wild guess (can't test it):


$VirtComputerNameS = "Windows 2000 Server"
$VirtServerO = new-object -com VirtualServer.Application
#$VirtServerO | gm
$GuestOS = $VirtServerO.FindVirtualMachine($VirtComputerNameS) | where {$_.GuestOS}
$GuestOS.Shutdown()


-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Quote:

> Please, can you help me with this problem?
>
> I am converting this script from WSH :
> _____________________________________________
> / \
> VirtualComputerNameS = "Windows 2000 Server"
>
> Set objVS = CreateObject("VirtualServer.Application") Set objVM =
> objVS.FindVirtualMachine(VirtualComputerNameS)
>
> Set objGuestOS = objVM.GuestOS
> objGuestOS.Shutdown()
> \_____________________________________________/
> to PowerShell :
> _____________________________________________
> / \
> $VirtComputerNameS = "Windows 2000 Server"
>
> $VirtServerO = new-object -com VirtualServer.Application
> \_____________________________________________/
> .
> I don't know, how to convert 4. and 6. line ( Set objVM =
> objVS.FindVirtualMachine(VirtualComputerNameS) and Set objGuestOS =
> objVM.GuestOS ) ?
>

My System SpecsSystem Spec
Old 02-19-2008   #3 (permalink)
Hal Rottenberg


 
 

Re: Problem with convert from WSH-script

Shay Levi wrote:
Quote:

> Here's a wild wild guess (can't test it):
>
> $VirtComputerNameS = "Windows 2000 Server"
> $VirtServerO = new-object -com VirtualServer.Application
> #$VirtServerO | gm
> $GuestOS = $VirtServerO.FindVirtualMachine($VirtComputerNameS) | where
> {$_.GuestOS}
> $GuestOS.Shutdown()
Here's a correction to your WAG which I can also not test. I just noticed
that you didn't pull the GuestOS property out as his VBscript example had.

Replace:
Quote:

> $GuestOS = $VirtServerO.FindVirtualMachine($VirtComputerNameS) | where
> {$_.GuestOS}
With:
$GuestOS = $VirtServerO.FindVirtualMachine($VirtComputerNameS).GuestOS


--

Hal Rottenberg
Blog: http://halr9000.com
Webmaster, Psi (http://psi-im.org)
Co-host, PowerScripting Podcast (http://powerscripting.net)
My System SpecsSystem Spec
Old 02-20-2008   #4 (permalink)
David Kriz


 
 

Re: Problem with convert from WSH-script

Thank you for your help :-) , but it doesn't work.

After I run this script ... :
_____________________________________________
/ \
$VirtServerO = new-object -com VirtualServer.Application
#$VirtualServerO | get-member

$GuestOS = $VirtServerO.FindVirtualMachine("CcvVirtualPc002").GuestOS

Write-Host "1/3: Shutdown ..."
$GuestOS.Shutdown()

Write-Host "2/3: Sleep ..."
Start-Sleep -seconds 30

Write-Host "3/3: Startup ..."
$GuestOS.Startup()
\_____________________________________________/


.... I can see this text:
_____________________________________________
/ \
PS C:\> C:\Temp\Restart_Virtual_Machine.ps1
Exception calling "FindVirtualMachine" with "1" argument(s): "Either a
required impersonation level was not provided, o
r the provided impersonation level is invalid. (Exception from HRESULT:
0x80070542)"
At C:\Temp\Restart_Virtual_Machine.ps1:4 char:43
+ $GuestOS = $VirtServerO.FindVirtualMachine( <<<<
"CcvVirtualPc002").GuestOS
1/3: Shutdown ...
You cannot call a method on a null-valued expression.
At C:\Temp\Restart_Virtual_Machine.ps1:7 char:18
+ $GuestOS.Shutdown( <<<< )
2/3: Sleep ...
3/3: Startup ...
You cannot call a method on a null-valued expression.
At C:\Temp\Restart_Virtual_Machine.ps1:13 char:17
+ $GuestOS.Startup( <<<< )
PS C:\>
\_____________________________________________/

:-(

Hal Rottenberg wrote:
Quote:

> Shay Levi wrote:
Quote:

>> Here's a wild wild guess (can't test it):
>>
>> $VirtComputerNameS = "Windows 2000 Server"
>> $VirtServerO = new-object -com VirtualServer.Application
>> #$VirtServerO | gm
>> $GuestOS = $VirtServerO.FindVirtualMachine($VirtComputerNameS) | where
>> {$_.GuestOS}
>> $GuestOS.Shutdown()
>
> Here's a correction to your WAG which I can also not test. I just
> noticed that you didn't pull the GuestOS property out as his VBscript
> example had.
>
> Replace:
Quote:

> > $GuestOS = $VirtServerO.FindVirtualMachine($VirtComputerNameS) | where
> > {$_.GuestOS}
> With:
> $GuestOS = $VirtServerO.FindVirtualMachine($VirtComputerNameS).GuestOS
>
>
My System SpecsSystem Spec
Old 02-20-2008   #5 (permalink)
Shay Levi


 
 

Re: Problem with convert from WSH-script

Can you post the output of :

1. $VirtualServerO | get-member
2. ($VirtualServerO | get-member FindVirtualMachine).Definition
3. $VirtServerO.FindVirtualMachine("CcvVirtualPc002") | get-member


# try this too
$vs= new-object -com VirtualServer.Application
$vs.FindVirtualMachine("Virtual Machine Name").GuestOS.Shutdown()


I found that there is also a boolean member called CanShutdown. You should
check
its before trying to shutdown the os.



-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Quote:

> Thank you for your help :-) , but it doesn't work.
>
> After I run this script ... :
> _____________________________________________
> / \
> $VirtServerO = new-object -com VirtualServer.Application
> #$VirtualServerO | get-member
>
> $GuestOS = $VirtServerO.FindVirtualMachine("CcvVirtualPc002").GuestOS
>
> Write-Host "1/3: Shutdown ..."
> $GuestOS.Shutdown()
> Write-Host "2/3: Sleep ..."
> Start-Sleep -seconds 30
> Write-Host "3/3: Startup ..."
> $GuestOS.Startup()
> \_____________________________________________/
> ... I can see this text:
> _____________________________________________
> / \
> PS C:\> C:\Temp\Restart_Virtual_Machine.ps1
> Exception calling "FindVirtualMachine" with "1" argument(s): "Either a
> required impersonation level was not provided, o
> r the provided impersonation level is invalid. (Exception from
> HRESULT:
> 0x80070542)"
> At C:\Temp\Restart_Virtual_Machine.ps1:4 char:43
> + $GuestOS = $VirtServerO.FindVirtualMachine( <<<<
> "CcvVirtualPc002").GuestOS
> 1/3: Shutdown ...
> You cannot call a method on a null-valued expression.
> At C:\Temp\Restart_Virtual_Machine.ps1:7 char:18
> + $GuestOS.Shutdown( <<<< )
> 2/3: Sleep ...
> 3/3: Startup ...
> You cannot call a method on a null-valued expression.
> At C:\Temp\Restart_Virtual_Machine.ps1:13 char:17
> + $GuestOS.Startup( <<<< )
> PS C:\>
> \_____________________________________________/
> :-(
>
> Hal Rottenberg wrote:
>
Quote:

>> Shay Levi wrote:
>>
Quote:

>>> Here's a wild wild guess (can't test it):
>>>
>>> $VirtComputerNameS = "Windows 2000 Server"
>>> $VirtServerO = new-object -com VirtualServer.Application
>>> #$VirtServerO | gm
>>> $GuestOS = $VirtServerO.FindVirtualMachine($VirtComputerNameS) |
>>> where
>>> {$_.GuestOS}
>>> $GuestOS.Shutdown()
>> Here's a correction to your WAG which I can also not test. I
>> just noticed that you didn't pull the GuestOS property out as his
>> VBscript example had.
>>
>> Replace:
>>
Quote:

>>> $GuestOS = $VirtServerO.FindVirtualMachine($VirtComputerNameS) |
>>> where {$_.GuestOS}
>>>
>> With:
>> $GuestOS =
>> $VirtServerO.FindVirtualMachine($VirtComputerNameS).GuestOS

My System SpecsSystem Spec
Old 02-20-2008   #6 (permalink)
Hal Rottenberg


 
 

Re: Problem with convert from WSH-script

David Kriz wrote:
Quote:

> Thank you for your help :-) , but it doesn't work.
>
> After I run this script ... :
There's your problem right there. Get out of the Vbscript mode, man! Run these
statements at a powershell prompt, trust me, you will learn a lot this way.
Quote:

> $VirtServerO = new-object -com VirtualServer.Application
this should work
Quote:

> $VirtualServerO | get-member
Run this one at a prompt. (Note I removed the comment (#) symbol.) Look at the
results. This will give you guidance on how to continue as Shay and I don't
have the software you are working with so we were making guesses. (BTW, what
software is this exactly? MSVS? MSVPC? What version?)
Quote:

> $GuestOS = $VirtServerO.FindVirtualMachine("CcvVirtualPc002").GuestOS
If this command fails then all the ones after will as well. Look at the
Properties (values) and Methods (actions) returned from Get-Member.

The error this line caused was:

Exception calling "FindVirtualMachine" with "1" argument(s): "Either a required
impersonation level was not provided, o
r the provided impersonation level is invalid. (Exception from HRESULT:
0x80070542)"

This is a security credentials error. Are you doing this remotely or from the
console of your virtual server? Try it while logged in as someone with
permission to list virtual machines. There may be some arcane stuff required to
make the authentication happen, don't know at this point.

--

Hal Rottenberg
Blog: http://halr9000.com
Webmaster, Psi (http://psi-im.org)
Co-host, PowerScripting Podcast (http://powerscripting.net)
My System SpecsSystem Spec
Old 02-20-2008   #7 (permalink)
David Kriz


 
 

Re: Problem with convert from WSH-script

Thank you for help :-)
I added your commands to my script:
_____________________________________________
/ \
$VirtServerO = new-object -com VirtualServer.Application

Write-Host "1. Output for Shay Levi :"
$VirtServerO | get-member

Write-Host "2. Output for Shay Levi :"
($VirtualServerO | get-member FindVirtualMachine).Definition

Write-Host "3. Output for Shay Levi :"
$VirtServerO.FindVirtualMachine("CcvVirtualPc002") | get-member

$GuestOS = $VirtServerO.FindVirtualMachine("CcvVirtualPc002")
#.GuestOS

if ($?) {
Write-Host "1/3: Shutdown ..."
$GuestOS.Shutdown()

Write-Host "2/3: Sleep ..."
Start-Sleep -seconds 30

Write-Host "3/3: Startup ..."
$GuestOS.Startup()
}
\_____________________________________________/


And here is the output:
_____________________________________________
/ \
PS U:\> C:\Temp\Restart_Virtual_Machine.ps1
1. Output for Shay Levi :

2. Output for Shay Levi :
3. Output for Shay Levi :

TypeName: System.__ComObject#{d1e64c50-a25d-450f-be0b-9ca5a354cff4}

Name MemberType Definition
---- ---------- ----------
AttachScriptToEvent Method void
AttachScriptToEvent (VMEventType, string)
CreateDifferencingVirtualHardDisk Method IVMTask
CreateDifferencingVirtualHardDisk (string, string)
CreateDynamicVirtualHardDisk Method IVMTask
CreateDynamicVirtualHardDisk (string, int)
CreateFixedVirtualHardDisk Method IVMTask
CreateFixedVirtualHardDisk (string, int)
CreateFloppyDiskImage Method void
CreateFloppyDiskImage (string, VMFloppyDiskImageType)
CreateHostDriveVirtualHardDisk Method IVMTask
CreateHostDriveVirtualHardDisk (string, string, bool)
CreateVirtualMachine Method IVMVirtualMachine
CreateVirtualMachine (string, string)
CreateVirtualNetwork Method IVMVirtualNetwork
CreateVirtualNetwork (string, string)
DeleteVirtualMachine Method void
DeleteVirtualMachine (IVMVirtualMachine)
DeleteVirtualNetwork Method void
DeleteVirtualNetwork (IVMVirtualNetwork)
FetchScriptByEvent Method string
FetchScriptByEvent (VMEventType)
FindVirtualMachine Method IVMVirtualMachine
FindVirtualMachine (string)
FindVirtualNetwork Method IVMVirtualNetwork
FindVirtualNetwork (string)
GetConfigurationValue Method Variant
GetConfigurationValue (string)
GetDVDFiles Method Variant GetDVDFiles
(Variant)
GetFloppyDiskFiles Method Variant
GetFloppyDiskFiles (Variant)
GetFloppyDiskImageType Method VMFloppyDiskImageType
GetFloppyDiskImageType (string)
GetHardDisk Method IVMHardDisk
GetHardDisk (string)
GetHardDiskFiles Method Variant
GetHardDiskFiles (Variant)
GetVirtualMachineFiles Method Variant
GetVirtualMachineFiles (Variant, bool)
GetVirtualNetworkFiles Method Variant
GetVirtualNetworkFiles (Variant, bool)
QueryLocale Method uint QueryLocale (string)
RegisterVirtualMachine Method IVMVirtualMachine
RegisterVirtualMachine (string, string)
RegisterVirtualNetwork Method IVMVirtualNetwork
RegisterVirtualNetwork (string, string)
RemoveConfigurationValue Method void
RemoveConfigurationValue (string)
RemoveScriptFromEvent Method void
RemoveScriptFromEvent (VMEventType)
SetConfigurationValue Method void
SetConfigurationValue (string, Variant)
UnregisterVirtualMachine Method void
UnregisterVirtualMachine (IVMVirtualMachine)
UnregisterVirtualNetwork Method void
UnregisterVirtualNetwork (IVMVirtualNetwork)
VMRCCreateEncryptionCertificateRequest Method string
VMRCCreateEncryptionCertificateRequest (string, int)
AvailableSystemCapacity Property Variant
AvailableSystemCapacity () {get}
DefaultLocale Property uint DefaultLocale ()
{get}
DefaultVMConfigurationPath Property string
DefaultVMConfigurationPath () {get} {set}
DefaultVNConfigurationPath Property string
DefaultVNConfigurationPath () {get}
HostInfo Property IVMHostInfo HostInfo
() {get}
Locale Property {get} {set}
MaximumFloppyDrivesPerVM Property int
MaximumFloppyDrivesPerVM () {get}
MaximumMemoryPerVM Property int MaximumMemoryPerVM
() {get}
MaximumNetworkAdaptersPerVM Property int
MaximumNetworkAdaptersPerVM () {get}
MaximumNumberOfIDEBuses Property int
MaximumNumberOfIDEBuses () {get}
MaximumNumberOfSCSIControllers Property int
MaximumNumberOfSCSIControllers () {get}
MaximumParallelPortsPerVM Property int
MaximumParallelPortsPerVM () {get}
MaximumSerialPortsPerVM Property int
MaximumSerialPortsPerVM () {get}
MinimumMemoryPerVM Property int MinimumMemoryPerVM
() {get}
Name Property string Name () {get}
ProductID Property string ProductID () {get}
SearchPaths Property Variant SearchPaths ()
{get} {set}
Security Property IVMSecurity Security
() {get} {set}
SuggestedMaximumMemoryPerVM Property int
SuggestedMaximumMemoryPerVM () {get}
SupportDrivers Property
IVMSupportDriverCollection SupportDrivers () {get}
Tasks Property IVMTaskCollection
Tasks () {get}
UnconnectedNetworkAdapters Property
IVMNetworkAdapterCollection UnconnectedNetworkAdapters () {get}
UpTime Property int UpTime () {get}
Version Property string Version () {get}
VirtualMachines Property
IVMVirtualMachineCollection VirtualMachines () {get}
VirtualNetworks Property
IVMVirtualNetworkCollection VirtualNetworks () {get}
VMRCAdminAddress Property string
VMRCAdminAddress () {get} {set}
VMRCAdminPortNumber Property int
VMRCAdminPortNumber () {get} {set}
VMRCAuthenticator Property IVMRCAuthenticator
VMRCAuthenticator () {get} {set}
VMRCAuthenticators Property
IVMRCAuthenticatorCollection VMRCAuthenticators () {get}
VMRCEnabled Property bool VMRCEnabled ()
{get} {set}
VMRCEncryptionCertificate Property string
VMRCEncryptionCertificate () {get} {set}
VMRCEncryptionCertificateRequest Property string
VMRCEncryptionCertificateRequest () {get}
VMRCEncryptionEnabled Property bool
VMRCEncryptionEnabled () {get} {set}
VMRCIdleConnectionTimeout Property int
VMRCIdleConnectionTimeout () {get} {set}
VMRCIdleConnectionTimeoutEnabled Property bool
VMRCIdleConnectionTimeoutEnabled () {get} {set}
VMRCXResolution Property int VMRCXResolution ()
{get} {set}
VMRCYResolution Property int VMRCYResolution ()
{get} {set}
VMScriptsEnabled Property bool VMScriptsEnabled
() {get} {set}
VSScriptsEnabled Property bool VSScriptsEnabled
() {get} {set}
Get-Member : No object has been specified to get-member.
At C:\Temp\Restart_Virtual_Machine.ps1:7 char:30
+ ($VirtualServerO | get-member <<<< FindVirtualMachine).Definition
Exception calling "FindVirtualMachine" with "1" argument(s): "Either a
required impersonation level was not provided, o
r the provided impersonation level is invalid. (Exception from HRESULT:
0x80070542)"
At C:\Temp\Restart_Virtual_Machine.ps1:10 char:32
+ $VirtServerO.FindVirtualMachine( <<<< "CcvVirtualPc002") | get-member
Exception calling "FindVirtualMachine" with "1" argument(s): "Either a
required impersonation level was not provided, o
r the provided impersonation level is invalid. (Exception from HRESULT:
0x80070542)"
At C:\Temp\Restart_Virtual_Machine.ps1:12 char:43
+ $GuestOS = $VirtServerO.FindVirtualMachine( <<<< "CcvVirtualPc002")
\_____________________________________________/

BTW, I am using "Microsoft Virtual Server" version "1.1.604.0 EE R2 SP1"
and I am member of "Domain Admins" group. For that reason I think that
in permissions or rights is not problem.

Shay Levi wrote:
Quote:

> Can you post the output of :
>
> 1. $VirtualServerO | get-member 2. ($VirtualServerO | get-member
> FindVirtualMachine).Definition
> 3. $VirtServerO.FindVirtualMachine("CcvVirtualPc002") | get-member
>
> # try this too
> $vs= new-object -com VirtualServer.Application
> $vs.FindVirtualMachine("Virtual Machine Name").GuestOS.Shutdown()
>
> I found that there is also a boolean member called CanShutdown. You
> should check
> its before trying to shutdown the os.
>
>
>
> -----
> Shay Levi
> $cript Fanatic
> http://scriptolog.blogspot.com
>
Quote:

>> Thank you for your help :-) , but it doesn't work.
>>
>> After I run this script ... :
>> _____________________________________________
>> / \
>> $VirtServerO = new-object -com VirtualServer.Application
>> #$VirtualServerO | get-member
>>
>> $GuestOS = $VirtServerO.FindVirtualMachine("CcvVirtualPc002").GuestOS
>>
>> Write-Host "1/3: Shutdown ..."
>> $GuestOS.Shutdown()
>> Write-Host "2/3: Sleep ..."
>> Start-Sleep -seconds 30
>> Write-Host "3/3: Startup ..."
>> $GuestOS.Startup()
>> \_____________________________________________/
>> ... I can see this text:
>> _____________________________________________
>> / \
>> PS C:\> C:\Temp\Restart_Virtual_Machine.ps1
>> Exception calling "FindVirtualMachine" with "1" argument(s): "Either a
>> required impersonation level was not provided, o
>> r the provided impersonation level is invalid. (Exception from
>> HRESULT:
>> 0x80070542)"
>> At C:\Temp\Restart_Virtual_Machine.ps1:4 char:43
>> + $GuestOS = $VirtServerO.FindVirtualMachine( <<<<
>> "CcvVirtualPc002").GuestOS
>> 1/3: Shutdown ...
>> You cannot call a method on a null-valued expression.
>> At C:\Temp\Restart_Virtual_Machine.ps1:7 char:18
>> + $GuestOS.Shutdown( <<<< )
>> 2/3: Sleep ...
>> 3/3: Startup ...
>> You cannot call a method on a null-valued expression.
>> At C:\Temp\Restart_Virtual_Machine.ps1:13 char:17
>> + $GuestOS.Startup( <<<< )
>> PS C:\>
>> \_____________________________________________/
>> :-(
>>
>> Hal Rottenberg wrote:
>>
Quote:

>>> Shay Levi wrote:
>>>
>>>> Here's a wild wild guess (can't test it):
>>>>
>>>> $VirtComputerNameS = "Windows 2000 Server"
>>>> $VirtServerO = new-object -com VirtualServer.Application
>>>> #$VirtServerO | gm
>>>> $GuestOS = $VirtServerO.FindVirtualMachine($VirtComputerNameS) |
>>>> where
>>>> {$_.GuestOS}
>>>> $GuestOS.Shutdown()
>>> Here's a correction to your WAG which I can also not test. I
>>> just noticed that you didn't pull the GuestOS property out as his
>>> VBscript example had.
>>>
>>> Replace:
>>>
>>>> $GuestOS = $VirtServerO.FindVirtualMachine($VirtComputerNameS) |
>>>> where {$_.GuestOS}
>>>>
>>> With:
>>> $GuestOS =
>>> $VirtServerO.FindVirtualMachine($VirtComputerNameS).GuestOS
>
>
My System SpecsSystem Spec
Old 02-21-2008   #8 (permalink)
Shay Levi


 
 

Re: Problem with convert from WSH-script



The following links might be helpful:


Querying guest operating system information with Powershell
http://blogs.msdn.com/virtual_pc_guy...owershell.aspx

Controlling Virtual Server through Microsoft PowerShell
http://blogs.msdn.com/jaybaz_ms/arch...owershell.aspx

Controlling Virtual Server through PowerShell
http://blogs.msdn.com/virtual_pc_guy...13/630165.aspx




-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Quote:

> Thank you for help :-)
> I added your commands to my script:
> _____________________________________________
> / \
> $VirtServerO = new-object -com VirtualServer.Application
>
> Write-Host "1. Output for Shay Levi :"
> $VirtServerO | get-member
> Write-Host "2. Output for Shay Levi :"
> ($VirtualServerO | get-member FindVirtualMachine).Definition
> Write-Host "3. Output for Shay Levi :"
> $VirtServerO.FindVirtualMachine("CcvVirtualPc002") | get-member
> $GuestOS = $VirtServerO.FindVirtualMachine("CcvVirtualPc002")
> #.GuestOS
>
> if ($?) {
> Write-Host "1/3: Shutdown ..."
> $GuestOS.Shutdown()
> Write-Host "2/3: Sleep ..."
> Start-Sleep -seconds 30
> Write-Host "3/3: Startup ..."
> $GuestOS.Startup()
> }
> \_____________________________________________/
>
> And here is the output:
> _____________________________________________
> / \
> PS U:\> C:\Temp\Restart_Virtual_Machine.ps1
> 1. Output for Shay Levi :
> 2. Output for Shay Levi :
> 3. Output for Shay Levi :
> TypeName:
> System.__ComObject#{d1e64c50-a25d-450f-be0b-9ca5a354cff4}
>
> Name MemberType Definition
> ---- ---------- ----------
> AttachScriptToEvent Method void
> AttachScriptToEvent (VMEventType, string)
> CreateDifferencingVirtualHardDisk Method IVMTask
> CreateDifferencingVirtualHardDisk (string, string)
> CreateDynamicVirtualHardDisk Method IVMTask
> CreateDynamicVirtualHardDisk (string, int)
> CreateFixedVirtualHardDisk Method IVMTask
> CreateFixedVirtualHardDisk (string, int)
> CreateFloppyDiskImage Method void
> CreateFloppyDiskImage (string, VMFloppyDiskImageType)
> CreateHostDriveVirtualHardDisk Method IVMTask
> CreateHostDriveVirtualHardDisk (string, string, bool)
> CreateVirtualMachine Method IVMVirtualMachine
> CreateVirtualMachine (string, string)
> CreateVirtualNetwork Method IVMVirtualNetwork
> CreateVirtualNetwork (string, string)
> DeleteVirtualMachine Method void
> DeleteVirtualMachine (IVMVirtualMachine)
> DeleteVirtualNetwork Method void
> DeleteVirtualNetwork (IVMVirtualNetwork)
> FetchScriptByEvent Method string
> FetchScriptByEvent (VMEventType)
> FindVirtualMachine Method IVMVirtualMachine
> FindVirtualMachine (string)
> FindVirtualNetwork Method IVMVirtualNetwork
> FindVirtualNetwork (string)
> GetConfigurationValue Method Variant
> GetConfigurationValue (string)
> GetDVDFiles Method Variant GetDVDFiles
> (Variant)
> GetFloppyDiskFiles Method Variant
> GetFloppyDiskFiles (Variant)
> GetFloppyDiskImageType Method
> VMFloppyDiskImageType
> GetFloppyDiskImageType (string)
> GetHardDisk Method IVMHardDisk
> GetHardDisk (string)
> GetHardDiskFiles Method Variant
> GetHardDiskFiles (Variant)
> GetVirtualMachineFiles Method Variant
> GetVirtualMachineFiles (Variant, bool)
> GetVirtualNetworkFiles Method Variant
> GetVirtualNetworkFiles (Variant, bool)
> QueryLocale Method uint QueryLocale
> (string)
> RegisterVirtualMachine Method IVMVirtualMachine
> RegisterVirtualMachine (string, string)
> RegisterVirtualNetwork Method IVMVirtualNetwork
> RegisterVirtualNetwork (string, string)
> RemoveConfigurationValue Method void
> RemoveConfigurationValue (string)
> RemoveScriptFromEvent Method void
> RemoveScriptFromEvent (VMEventType)
> SetConfigurationValue Method void
> SetConfigurationValue (string, Variant)
> UnregisterVirtualMachine Method void
> UnregisterVirtualMachine (IVMVirtualMachine)
> UnregisterVirtualNetwork Method void
> UnregisterVirtualNetwork (IVMVirtualNetwork)
> VMRCCreateEncryptionCertificateRequest Method string
> VMRCCreateEncryptionCertificateRequest (string, int)
> AvailableSystemCapacity Property Variant
> AvailableSystemCapacity () {get}
> DefaultLocale Property uint DefaultLocale
> ()
> {get}
> DefaultVMConfigurationPath Property string
> DefaultVMConfigurationPath () {get} {set}
> DefaultVNConfigurationPath Property string
> DefaultVNConfigurationPath () {get}
> HostInfo Property IVMHostInfo HostInfo
> () {get}
> Locale Property {get} {set}
> MaximumFloppyDrivesPerVM Property int
> MaximumFloppyDrivesPerVM () {get}
> MaximumMemoryPerVM Property int
> MaximumMemoryPerVM
> () {get}
> MaximumNetworkAdaptersPerVM Property int
> MaximumNetworkAdaptersPerVM () {get}
> MaximumNumberOfIDEBuses Property int
> MaximumNumberOfIDEBuses () {get}
> MaximumNumberOfSCSIControllers Property int
> MaximumNumberOfSCSIControllers () {get}
> MaximumParallelPortsPerVM Property int
> MaximumParallelPortsPerVM () {get}
> MaximumSerialPortsPerVM Property int
> MaximumSerialPortsPerVM () {get}
> MinimumMemoryPerVM Property int
> MinimumMemoryPerVM
> () {get}
> Name Property string Name () {get}
> ProductID Property string ProductID ()
> {get}
> SearchPaths Property Variant SearchPaths
> ()
> {get} {set}
> Security Property IVMSecurity Security
> () {get} {set}
> SuggestedMaximumMemoryPerVM Property int
> SuggestedMaximumMemoryPerVM () {get}
> SupportDrivers Property
> IVMSupportDriverCollection SupportDrivers () {get}
> Tasks Property IVMTaskCollection
> Tasks () {get}
> UnconnectedNetworkAdapters Property
> IVMNetworkAdapterCollection UnconnectedNetworkAdapters () {get}
> UpTime Property int UpTime () {get}
> Version Property string Version ()
> {get}
> VirtualMachines Property
> IVMVirtualMachineCollection VirtualMachines () {get}
> VirtualNetworks Property
> IVMVirtualNetworkCollection VirtualNetworks () {get}
> VMRCAdminAddress Property string
> VMRCAdminAddress () {get} {set}
> VMRCAdminPortNumber Property int
> VMRCAdminPortNumber () {get} {set}
> VMRCAuthenticator Property IVMRCAuthenticator
> VMRCAuthenticator () {get} {set}
> VMRCAuthenticators Property
> IVMRCAuthenticatorCollection VMRCAuthenticators () {get}
> VMRCEnabled Property bool VMRCEnabled ()
> {get} {set}
> VMRCEncryptionCertificate Property string
> VMRCEncryptionCertificate () {get} {set}
> VMRCEncryptionCertificateRequest Property string
> VMRCEncryptionCertificateRequest () {get}
> VMRCEncryptionEnabled Property bool
> VMRCEncryptionEnabled () {get} {set}
> VMRCIdleConnectionTimeout Property int
> VMRCIdleConnectionTimeout () {get} {set}
> VMRCIdleConnectionTimeoutEnabled Property bool
> VMRCIdleConnectionTimeoutEnabled () {get} {set}
> VMRCXResolution Property int VMRCXResolution
> ()
> {get} {set}
> VMRCYResolution Property int VMRCYResolution
> ()
> {get} {set}
> VMScriptsEnabled Property bool
> VMScriptsEnabled
> () {get} {set}
> VSScriptsEnabled Property bool
> VSScriptsEnabled
> () {get} {set}
> Get-Member : No object has been specified to get-member.
> At C:\Temp\Restart_Virtual_Machine.ps1:7 char:30
> + ($VirtualServerO | get-member <<<< FindVirtualMachine).Definition
> Exception calling "FindVirtualMachine" with "1" argument(s): "Either a
> required impersonation level was not provided, o
> r the provided impersonation level is invalid. (Exception from
> HRESULT:
> 0x80070542)"
> At C:\Temp\Restart_Virtual_Machine.ps1:10 char:32
> + $VirtServerO.FindVirtualMachine( <<<< "CcvVirtualPc002") |
> get-member
> Exception calling "FindVirtualMachine" with "1" argument(s): "Either a
> required impersonation level was not provided, o
> r the provided impersonation level is invalid. (Exception from
> HRESULT:
> 0x80070542)"
> At C:\Temp\Restart_Virtual_Machine.ps1:12 char:43
> + $GuestOS = $VirtServerO.FindVirtualMachine( <<<< "CcvVirtualPc002")
> \_____________________________________________/
> BTW, I am using "Microsoft Virtual Server" version "1.1.604.0 EE R2
> SP1" and I am member of "Domain Admins" group. For that reason I think
> that in permissions or rights is not problem.
>
> Shay Levi wrote:
>
Quote:

>> Can you post the output of :
>>
>> 1. $VirtualServerO | get-member 2. ($VirtualServerO | get-member
>> FindVirtualMachine).Definition
>> 3. $VirtServerO.FindVirtualMachine("CcvVirtualPc002") | get-member
>> # try this too
>> $vs= new-object -com VirtualServer.Application
>> $vs.FindVirtualMachine("Virtual Machine Name").GuestOS.Shutdown()
>> I found that there is also a boolean member called CanShutdown. You
>> should check
>> its before trying to shutdown the os.
>> -----
>> Shay Levi
>> $cript Fanatic
>> http://scriptolog.blogspot.com
Quote:

>>> Thank you for your help :-) , but it doesn't work.
>>>
>>> After I run this script ... :
>>> _____________________________________________
>>> / \
>>> $VirtServerO = new-object -com VirtualServer.Application
>>> #$VirtualServerO | get-member
>>> $GuestOS =
>>> $VirtServerO.FindVirtualMachine("CcvVirtualPc002").GuestOS
>>>
>>> Write-Host "1/3: Shutdown ..."
>>> $GuestOS.Shutdown()
>>> Write-Host "2/3: Sleep ..."
>>> Start-Sleep -seconds 30
>>> Write-Host "3/3: Startup ..."
>>> $GuestOS.Startup()
>>> \_____________________________________________/
>>> ... I can see this text:
>>> _____________________________________________
>>> / \
>>> PS C:\> C:\Temp\Restart_Virtual_Machine.ps1
>>> Exception calling "FindVirtualMachine" with "1" argument(s): "Either
>>> a
>>> required impersonation level was not provided, o
>>> r the provided impersonation level is invalid. (Exception from
>>> HRESULT:
>>> 0x80070542)"
>>> At C:\Temp\Restart_Virtual_Machine.ps1:4 char:43
>>> + $GuestOS = $VirtServerO.FindVirtualMachine( <<<<
>>> "CcvVirtualPc002").GuestOS
>>> 1/3: Shutdown ...
>>> You cannot call a method on a null-valued expression.
>>> At C:\Temp\Restart_Virtual_Machine.ps1:7 char:18
>>> + $GuestOS.Shutdown( <<<< )
>>> 2/3: Sleep ...
>>> 3/3: Startup ...
>>> You cannot call a method on a null-valued expression.
>>> At C:\Temp\Restart_Virtual_Machine.ps1:13 char:17
>>> + $GuestOS.Startup( <<<< )
>>> PS C:\>
>>> \_____________________________________________/
>>> :-(
>>> Hal Rottenberg wrote:
>>>
>>>> Shay Levi wrote:
>>>>
>>>>> Here's a wild wild guess (can't test it):
>>>>>
>>>>> $VirtComputerNameS = "Windows 2000 Server"
>>>>> $VirtServerO = new-object -com VirtualServer.Application
>>>>> #$VirtServerO | gm
>>>>> $GuestOS = $VirtServerO.FindVirtualMachine($VirtComputerNameS) |
>>>>> where
>>>>> {$_.GuestOS}
>>>>> $GuestOS.Shutdown()
>>>> Here's a correction to your WAG which I can also not test. I
>>>> just noticed that you didn't pull the GuestOS property out as his
>>>> VBscript example had.
>>>>
>>>> Replace:
>>>>
>>>>> $GuestOS = $VirtServerO.FindVirtualMachine($VirtComputerNameS) |
>>>>> where {$_.GuestOS}
>>>>>
>>>> With:
>>>> $GuestOS =
>>>> $VirtServerO.FindVirtualMachine($VirtComputerNameS).GuestOS

My System SpecsSystem Spec
Old 02-21-2008   #9 (permalink)
David Kriz


 
 

Re: Problem with convert from WSH-script

Yes! This will be reason of my problem!
Thank you very much for help :-)

Shay Levi wrote:
Quote:

>
>
> The following links might be helpful:
>
>
> Querying guest operating system information with Powershell
> http://blogs.msdn.com/virtual_pc_guy...owershell.aspx
>
>
> Controlling Virtual Server through Microsoft PowerShell
> http://blogs.msdn.com/jaybaz_ms/arch...owershell.aspx
>
>
> Controlling Virtual Server through PowerShell
> http://blogs.msdn.com/virtual_pc_guy...13/630165.aspx
>
>
>
>
> -----
> Shay Levi
> $cript Fanatic
> http://scriptolog.blogspot.com
>
Quote:

>> Thank you for help :-)
>> I added your commands to my script:
>> _____________________________________________
>> / \
>> $VirtServerO = new-object -com VirtualServer.Application
>>
>> Write-Host "1. Output for Shay Levi :"
>> $VirtServerO | get-member
>> Write-Host "2. Output for Shay Levi :"
>> ($VirtualServerO | get-member FindVirtualMachine).Definition
>> Write-Host "3. Output for Shay Levi :"
>> $VirtServerO.FindVirtualMachine("CcvVirtualPc002") | get-member
>> $GuestOS = $VirtServerO.FindVirtualMachine("CcvVirtualPc002")
>> #.GuestOS
>>
>> if ($?) {
>> Write-Host "1/3: Shutdown ..."
>> $GuestOS.Shutdown()
>> Write-Host "2/3: Sleep ..."
>> Start-Sleep -seconds 30
>> Write-Host "3/3: Startup ..."
>> $GuestOS.Startup()
>> }
>> \_____________________________________________/
>>
>> And here is the output:
>> _____________________________________________
>> / \
>> PS U:\> C:\Temp\Restart_Virtual_Machine.ps1
>> 1. Output for Shay Levi :
>> 2. Output for Shay Levi :
>> 3. Output for Shay Levi :
>> TypeName:
>> System.__ComObject#{d1e64c50-a25d-450f-be0b-9ca5a354cff4}
>>
>> Name MemberType Definition
>> ---- ---------- ----------
>> AttachScriptToEvent Method void
>> AttachScriptToEvent (VMEventType, string)
>> CreateDifferencingVirtualHardDisk Method IVMTask
>> CreateDifferencingVirtualHardDisk (string, string)
>> CreateDynamicVirtualHardDisk Method IVMTask
>> CreateDynamicVirtualHardDisk (string, int)
>> CreateFixedVirtualHardDisk Method IVMTask
>> CreateFixedVirtualHardDisk (string, int)
>> CreateFloppyDiskImage Method void
>> CreateFloppyDiskImage (string, VMFloppyDiskImageType)
>> CreateHostDriveVirtualHardDisk Method IVMTask
>> CreateHostDriveVirtualHardDisk (string, string, bool)
>> CreateVirtualMachine Method IVMVirtualMachine
>> CreateVirtualMachine (string, string)
>> CreateVirtualNetwork Method IVMVirtualNetwork
>> CreateVirtualNetwork (string, string)
>> DeleteVirtualMachine Method void
>> DeleteVirtualMachine (IVMVirtualMachine)
>> DeleteVirtualNetwork Method void
>> DeleteVirtualNetwork (IVMVirtualNetwork)
>> FetchScriptByEvent Method string
>> FetchScriptByEvent (VMEventType)
>> FindVirtualMachine Method IVMVirtualMachine
>> FindVirtualMachine (string)
>> FindVirtualNetwork Method IVMVirtualNetwork
>> FindVirtualNetwork (string)
>> GetConfigurationValue Method Variant
>> GetConfigurationValue (string)
>> GetDVDFiles Method Variant GetDVDFiles
>> (Variant)
>> GetFloppyDiskFiles Method Variant
>> GetFloppyDiskFiles (Variant)
>> GetFloppyDiskImageType Method
>> VMFloppyDiskImageType
>> GetFloppyDiskImageType (string)
>> GetHardDisk Method IVMHardDisk
>> GetHardDisk (string)
>> GetHardDiskFiles Method Variant
>> GetHardDiskFiles (Variant)
>> GetVirtualMachineFiles Method Variant
>> GetVirtualMachineFiles (Variant, bool)
>> GetVirtualNetworkFiles Method Variant
>> GetVirtualNetworkFiles (Variant, bool)
>> QueryLocale Method uint QueryLocale
>> (string)
>> RegisterVirtualMachine Method IVMVirtualMachine
>> RegisterVirtualMachine (string, string)
>> RegisterVirtualNetwork Method IVMVirtualNetwork
>> RegisterVirtualNetwork (string, string)
>> RemoveConfigurationValue Method void
>> RemoveConfigurationValue (string)
>> RemoveScriptFromEvent Method void
>> RemoveScriptFromEvent (VMEventType)
>> SetConfigurationValue Method void
>> SetConfigurationValue (string, Variant)
>> UnregisterVirtualMachine Method void
>> UnregisterVirtualMachine (IVMVirtualMachine)
>> UnregisterVirtualNetwork Method void
>> UnregisterVirtualNetwork (IVMVirtualNetwork)
>> VMRCCreateEncryptionCertificateRequest Method string
>> VMRCCreateEncryptionCertificateRequest (string, int)
>> AvailableSystemCapacity Property Variant
>> AvailableSystemCapacity () {get}
>> DefaultLocale Property uint DefaultLocale
>> ()
>> {get}
>> DefaultVMConfigurationPath Property string
>> DefaultVMConfigurationPath () {get} {set}
>> DefaultVNConfigurationPath Property string
>> DefaultVNConfigurationPath () {get}
>> HostInfo Property IVMHostInfo HostInfo
>> () {get}
>> Locale Property {get} {set}
>> MaximumFloppyDrivesPerVM Property int
>> MaximumFloppyDrivesPerVM () {get}
>> MaximumMemoryPerVM Property int
>> MaximumMemoryPerVM
>> () {get}
>> MaximumNetworkAdaptersPerVM Property int
>> MaximumNetworkAdaptersPerVM () {get}
>> MaximumNumberOfIDEBuses Property int
>> MaximumNumberOfIDEBuses () {get}
>> MaximumNumberOfSCSIControllers Property int
>> MaximumNumberOfSCSIControllers () {get}
>> MaximumParallelPortsPerVM Property int
>> MaximumParallelPortsPerVM () {get}
>> MaximumSerialPortsPerVM Property int
>> MaximumSerialPortsPerVM () {get}
>> MinimumMemoryPerVM Property int
>> MinimumMemoryPerVM
>> () {get}
>> Name Property string Name () {get}
>> ProductID Property string ProductID ()
>> {get}
>> SearchPaths Property Variant SearchPaths
>> ()
>> {get} {set}
>> Security Property IVMSecurity Security
>> () {get} {set}
>> SuggestedMaximumMemoryPerVM Property int
>> SuggestedMaximumMemoryPerVM () {get}
>> SupportDrivers Property
>> IVMSupportDriverCollection SupportDrivers () {get}
>> Tasks Property IVMTaskCollection
>> Tasks () {get}
>> UnconnectedNetworkAdapters Property
>> IVMNetworkAdapterCollection UnconnectedNetworkAdapters () {get}
>> UpTime Property int UpTime () {get}
>> Version Property string Version ()
>> {get}
>> VirtualMachines Property
>> IVMVirtualMachineCollection VirtualMachines () {get}
>> VirtualNetworks Property
>> IVMVirtualNetworkCollection VirtualNetworks () {get}
>> VMRCAdminAddress Property string
>> VMRCAdminAddress () {get} {set}
>> VMRCAdminPortNumber Property int
>> VMRCAdminPortNumber () {get} {set}
>> VMRCAuthenticator Property IVMRCAuthenticator
>> VMRCAuthenticator () {get} {set}
>> VMRCAuthenticators Property
>> IVMRCAuthenticatorCollection VMRCAuthenticators () {get}
>> VMRCEnabled Property bool VMRCEnabled ()
>> {get} {set}
>> VMRCEncryptionCertificate Property string
>> VMRCEncryptionCertificate () {get} {set}
>> VMRCEncryptionCertificateRequest Property string
>> VMRCEncryptionCertificateRequest () {get}
>> VMRCEncryptionEnabled Property bool
>> VMRCEncryptionEnabled () {get} {set}
>> VMRCIdleConnectionTimeout Property int
>> VMRCIdleConnectionTimeout () {get} {set}
>> VMRCIdleConnectionTimeoutEnabled Property bool
>> VMRCIdleConnectionTimeoutEnabled () {get} {set}
>> VMRCXResolution Property int VMRCXResolution
>> ()
>> {get} {set}
>> VMRCYResolution Property int VMRCYResolution
>> ()
>> {get} {set}
>> VMScriptsEnabled Property bool
>> VMScriptsEnabled
>> () {get} {set}
>> VSScriptsEnabled Property bool
>> VSScriptsEnabled
>> () {get} {set}
>> Get-Member : No object has been specified to get-member.
>> At C:\Temp\Restart_Virtual_Machine.ps1:7 char:30
>> + ($VirtualServerO | get-member <<<< FindVirtualMachine).Definition
>> Exception calling "FindVirtualMachine" with "1" argument(s): "Either a
>> required impersonation level was not provided, o
>> r the provided impersonation level is invalid. (Exception from
>> HRESULT:
>> 0x80070542)"
>> At C:\Temp\Restart_Virtual_Machine.ps1:10 char:32
>> + $VirtServerO.FindVirtualMachine( <<<< "CcvVirtualPc002") |
>> get-member
>> Exception calling "FindVirtualMachine" with "1" argument(s): "Either a
>> required impersonation level was not provided, o
>> r the provided impersonation level is invalid. (Exception from
>> HRESULT:
>> 0x80070542)"
>> At C:\Temp\Restart_Virtual_Machine.ps1:12 char:43
>> + $GuestOS = $VirtServerO.FindVirtualMachine( <<<< "CcvVirtualPc002")
>> \_____________________________________________/
>> BTW, I am using "Microsoft Virtual Server" version "1.1.604.0 EE R2
>> SP1" and I am member of "Domain Admins" group. For that reason I think
>> that in permissions or rights is not problem.
>>
>> Shay Levi wrote:
>>
Quote:

>>> Can you post the output of :
>>>
>>> 1. $VirtualServerO | get-member 2. ($VirtualServerO | get-member
>>> FindVirtualMachine).Definition
>>> 3. $VirtServerO.FindVirtualMachine("CcvVirtualPc002") | get-member
>>> # try this too
>>> $vs= new-object -com VirtualServer.Application
>>> $vs.FindVirtualMachine("Virtual Machine Name").GuestOS.Shutdown()
>>> I found that there is also a boolean member called CanShutdown. You
>>> should check
>>> its before trying to shutdown the os.
>>> -----
>>> Shay Levi
>>> $cript Fanatic
>>> http://scriptolog.blogspot.com
>>>> Thank you for your help :-) , but it doesn't work.
>>>>
>>>> After I run this script ... :
>>>> _____________________________________________
>>>> / \
>>>> $VirtServerO = new-object -com VirtualServer.Application
>>>> #$VirtualServerO | get-member
>>>> $GuestOS =
>>>> $VirtServerO.FindVirtualMachine("CcvVirtualPc002").GuestOS
>>>>
>>>> Write-Host "1/3: Shutdown ..."
>>>> $GuestOS.Shutdown()
>>>> Write-Host "2/3: Sleep ..."
>>>> Start-Sleep -seconds 30
>>>> Write-Host "3/3: Startup ..."
>>>> $GuestOS.Startup()
>>>> \_____________________________________________/
>>>> ... I can see this text:
>>>> _____________________________________________
>>>> / \
>>>> PS C:\> C:\Temp\Restart_Virtual_Machine.ps1
>>>> Exception calling "FindVirtualMachine" with "1" argument(s): "Either
>>>> a
>>>> required impersonation level was not provided, o
>>>> r the provided impersonation level is invalid. (Exception from
>>>> HRESULT:
>>>> 0x80070542)"
>>>> At C:\Temp\Restart_Virtual_Machine.ps1:4 char:43
>>>> + $GuestOS = $VirtServerO.FindVirtualMachine( <<<<
>>>> "CcvVirtualPc002").GuestOS
>>>> 1/3: Shutdown ...
>>>> You cannot call a method on a null-valued expression.
>>>> At C:\Temp\Restart_Virtual_Machine.ps1:7 char:18
>>>> + $GuestOS.Shutdown( <<<< )
>>>> 2/3: Sleep ...
>>>> 3/3: Startup ...
>>>> You cannot call a method on a null-valued expression.
>>>> At C:\Temp\Restart_Virtual_Machine.ps1:13 char:17
>>>> + $GuestOS.Startup( <<<< )
>>>> PS C:\>
>>>> \_____________________________________________/
>>>> :-(
>>>> Hal Rottenberg wrote:
>>>>
>>>>> Shay Levi wrote:
>>>>>
>>>>>> Here's a wild wild guess (can't test it):
>>>>>>
>>>>>> $VirtComputerNameS = "Windows 2000 Server"
>>>>>> $VirtServerO = new-object -com VirtualServer.Application
>>>>>> #$VirtServerO | gm
>>>>>> $GuestOS = $VirtServerO.FindVirtualMachine($VirtComputerNameS) |
>>>>>> where
>>>>>> {$_.GuestOS}
>>>>>> $GuestOS.Shutdown()
>>>>> Here's a correction to your WAG which I can also not test. I
>>>>> just noticed that you didn't pull the GuestOS property out as his
>>>>> VBscript example had.
>>>>>
>>>>> Replace:
>>>>>
>>>>>> $GuestOS = $VirtServerO.FindVirtualMachine($VirtComputerNameS) |
>>>>>> where {$_.GuestOS}
>>>>>>
>>>>> With:
>>>>> $GuestOS =
>>>>> $VirtServerO.FindVirtualMachine($VirtComputerNameS).GuestOS
>
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Problem with VB-Script Warning System Security
Logon script problem Vista networking & sharing
problem passing args to script 'There is no script engine for file extenstion' VB Script
Convert VBS Script to Powershell? PowerShell
HowTo: Convert Function to script PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46