Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 175326

PowerCLI Invoke-VMScript Sporadic Execution

$
0
0

Issue Details: 

 

1. We use PowerCLI to get values from VMs.  There are instances where the values fail to return.  It is our belief that this worked flawlessly before and we can show that it still does in some instances.  We developed a test script to reproduce the problem as well as show instances where things appear to work correctly.  This script connects to a machine we chose.  We provide administrative credentials and the script returns the value 12345.  It does ten iterations of this task.  We expect 10/10. 

 

 

$creds = Get-Credential

$successes = 0; while ($true) {

$output = Invoke-VMScript -VM "MyVM" -ScriptText "return '12345'" -GuestCredential $creds

$output

if ($output.ScriptOutput) {$successes++}

if ($successes -eq 10) {break}

}

 

 

 

When we run this script against some servers it works flawlessly.  That is the return is 10/10.  When we look at the VM > Tasks & Events > Events  we see the following successive events which are normal.

 

(1) Guest operation Create Temporary File performed.

(2) Guest operation Start program performed.

(3) Guest operation List processes Performed.

(4) Guest operation List processes Performed.

(5) Guest operation Initiate File Transfer from Guest Perform.

(6) Guest operations Delete File performed.

 

 

The system repeats these events for each successful iteration.

 

 

2.  Our test script will make as many iterations as possible to get 10 successful results.   Ideally, it would only have to make 10 attempts to get 10 results.  But when there are failures, we have to make more than 10 attempts to get the desired results. I have seen it take as many as 19 attempts to get 10 successes.

 

 

3. As an additional data point, When running this script against the domain controller in an environment it works flawlessly.  However, when running against a domain joined machine in the domain, the problem happens. If I watch the creation of the Powershell## file in the temp directory on the system.  The ones that copy with 0 bytes are the ones that fail. 

 

 

Any ideas?

 

 

 

 

Thanks!


Viewing all articles
Browse latest Browse all 175326

Trending Articles