Fix and Finalize Powershell Script
$10-25 CAD
货到付款
Freelancers,
I have a powrshell script that should get the results/output from a cmdlet, add it an array and POST it to a REST api.
I need help debuging a powershell script and finalize it with with proper exit code. This should be a matter of a few minutes for a seasoned Powershell programmer.
Currently, the problem we are facing is when we loop through the vms (line 45) :
==========================================================================
PS C:\ps_scripts> powershell -ExecutionPolicy ByPass -File C:\ps_scripts\[url removed, login to view]
Measure-VM : A positional parameter cannot be found that accepts argument 'Ubuntu'.
At C:\ps_scripts\[url removed, login to view] char:14
+ ... $results = Measure-VM –VMName $[url removed, login to view]; Reset-VMResourceMetering ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Measure-VM], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,[url removed, login to view]
TESTED - When I run the following from the command line and not from the script it works correctly
==============================================================================
$results = Measure-VM –VMName Ubuntu ; Reset-VMResourceMetering –VMName Ubuntu
Write-Output $results
PS C:\ps_scripts> Write-Output $results
{"VMId":"00f521ee-c7ac-4d3f-b690-1cab25a907f0","VMName":"Ubuntu","CimSession":{"ComputerName":null,"InstanceId":"5db7399
a-736d-437e-a810-0b5481a25111"},"ComputerName":"ACER","MeteringDuration":{"Ticks":209740000,"Days":0,"Hours":0,"Millisec
onds":974,"Minutes":0,"Seconds":20,"TotalDays":0.00024275462962962963,"TotalHours":0.00582611
11111111109,"TotalMilliseco
nds":20974,"TotalMinutes":0.34956666666666669,"TotalSeconds":20.974},"AverageProcessorUsage":13,"AverageMemoryUsage":102
etc etc
Good Bidding
项目ID: #15871927