public override void ExecuteCmdlet()
        {
            ExecuteClientAction(() =>
            {
                if (ShouldProcess(this.VMScaleSetName, VerbsCommon.Set))
                {
                    string resourceGroupName = this.ResourceGroupName;
                    string vmScaleSetName    = this.VMScaleSetName;
                    string instanceId        = this.InstanceId;

                    if (this.ParameterSetName.Equals("FriendMethod"))
                    {
                        var result   = VirtualMachineScaleSetVMsClient.ReimageAll(resourceGroupName, vmScaleSetName, instanceId);
                        var psObject = new PSOperationStatusResponse();
                        ComputeAutomationAutoMapperProfile.Mapper.Map <Azure.Management.Compute.Models.OperationStatusResponse, PSOperationStatusResponse>(result, psObject);
                        WriteObject(psObject);
                    }
                    else
                    {
                        var result   = VirtualMachineScaleSetVMsClient.Reimage(resourceGroupName, vmScaleSetName, instanceId);
                        var psObject = new PSOperationStatusResponse();
                        ComputeAutomationAutoMapperProfile.Mapper.Map <Azure.Management.Compute.Models.OperationStatusResponse, PSOperationStatusResponse>(result, psObject);
                        WriteObject(psObject);
                    }
                }
            });
        }
        protected void ExecuteVirtualMachineScaleSetVMReimageAllMethod(object[] invokeMethodInputParameters)
        {
            string resourceGroupName = (string)ParseParameter(invokeMethodInputParameters[0]);
            string vmScaleSetName    = (string)ParseParameter(invokeMethodInputParameters[1]);
            string instanceId        = (string)ParseParameter(invokeMethodInputParameters[2]);

            VirtualMachineScaleSetVMsClient.ReimageAll(resourceGroupName, vmScaleSetName, instanceId);
        }
Пример #3
0
        protected override void ProcessRecord()
        {
            ExecuteClientAction(() =>
            {
                if (ShouldProcess(this.ResourceGroupName, VerbsCommon.Set))
                {
                    string resourceGroupName = this.ResourceGroupName;
                    string vmScaleSetName    = this.VMScaleSetName;
                    string instanceId        = this.InstanceId;

                    if (this.ParameterSetName.Equals("FriendMethod"))
                    {
                        var result = VirtualMachineScaleSetVMsClient.ReimageAll(resourceGroupName, vmScaleSetName, instanceId);
                        WriteObject(result);
                    }
                    else
                    {
                        var result = VirtualMachineScaleSetVMsClient.Reimage(resourceGroupName, vmScaleSetName, instanceId);
                        WriteObject(result);
                    }
                }
            });
        }