Quantcast
Channel: VMware Communities : Document List - vSphere PowerCLI
Viewing all articles
Browse latest Browse all 379

Invoke-VMscript output selection

$
0
0

Hi everyone,

 

I have some trouble to get a scriptout from an invoke-vmscript command.

 

first of all, i'm running powercli x32 5.1R2 on vshpere 5 (ESXi 5).

 

I'm running a script to display the license status of a windows 2008 R2 server as follow :

 

$script = "%SystemDrive%\Windows\System32\cscript.exe %windir%\system32\slmgr.vbs /dli"

$output = Invoke-VMScript -VM $vmname -ScriptText $script -GuestUser $GuestUser -GuestPassword $GuestPassword -ScriptType bat

write-host $output

[string]$licenseStatus = ($output | select-string -pattern "^License Status:")

write-host "licensestatus : $licenseStatus"

 

My problem is that my licenseStatus is null.

But my $output contains :

Microsoft (R) Windows Script Host Version 5.8

Copyright (C) Microsoft Corporation. All rights reserved.

 

 

 

 

Name: Windows Server(R), ServerStandard edition

Description: Windows Operating System - Windows Server(R), VOLUME_MAK_B channel

Partial Product Key: XXXXX

License Status: Licensed

 

Does anyone know how to get the output from a invoke-vmscript into a string ?

 

Thanks by advance.


Viewing all articles
Browse latest Browse all 379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>