Invoke-AzureRMVMRunCommand运行时间长(20-30分钟),而在VM中以交互方式运行的脚本需要10秒 [英] Invoke-AzureRMVMRunCommand takes a LONG TIME to run (20-30 minutes) whereas the script when run interactively in a VM takes 10 seconds

查看:40
本文介绍了Invoke-AzureRMVMRunCommand运行时间长(20-30分钟),而在VM中以交互方式运行的脚本需要10秒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此命令需要20-30分钟才能运行:


Invoke-AzureRMVMRunCommand -ResourceGroupName< RESOURGEGROUPNAME> -CommandId'RunPowerShellScript'-scriptpath'2011-03-21-STOP_Services.ps1'-asJob -vmname< VMNAME>



## ########## STOP_Services.ps1 #############


get-service * veeam * |停止服务 

get-service * veeam * | set-service -startuptype disabled


get-service * vmic * |停止服务 

get-service * vmic * | set-service -startuptype disabled


################################# #####



如果我在RDP进入AZURE VM后运行STOP_Services.ps1,则运行大约需要5秒钟。 / p>


如何让Invoke-AzureRMVMRunCommand执行得更快?





解决方案

 



可以使用-debug和-verbose运行命令并将结果分享给我?



问候, 


Msrini


This command takes 20-30 minutes to run:

Invoke-AzureRMVMRunCommand -ResourceGroupName <RESOURGEGROUPNAME> -CommandId 'RunPowerShellScript' -scriptpath '2019-03-21-STOP_Services.ps1' -asJob -vmname <VMNAME>

############ STOP_Services.ps1 #############

get-service *veeam* | stop-service 
get-service *veeam* | set-service -startuptype disabled

get-service *vmic* | stop-service 
get-service *vmic* | set-service -startuptype disabled

######################################

If I run STOP_Services.ps1 after I RDP into a AZURE VM, it takes approx 5 seconds to run.

What can I do to make Invoke-AzureRMVMRunCommand execute faster ?

解决方案

Hi, 

Can run the command with -debug and -verbose and share me the results?

Regards, 

Msrini


这篇关于Invoke-AzureRMVMRunCommand运行时间长(20-30分钟),而在VM中以交互方式运行的脚本需要10秒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆