云服务程序在启动的时候执行Powershell脚本
如果在云服务程序启动时候,需要执行Powershell脚本,我们需要将脚本嵌入到程序中,并且编写一个cmd来执行这个脚本,具体如下:
1.编写测试的Powershell脚本:每隔10分钟 检测dns
$TimeStart = Get-Date
$TimeEnd = $timeStart.addminutes(1440)
$name = "cnppmedia.blob.core.chinacloudapi.cn."
$result = "d:\nslookuplog.txt"
Write-Host "Start Time: $TimeStart"
write-host "End Time: $TimeEnd" Do {
$TimeNow = Get-Date
if ($TimeNow -ge $TimeEnd)
{ Write-host "It's time to finish." }
else
{
try
{
Write-host "===========NslookUp====Current Time : $(Get-Date)=============="
invoke-command -scriptblock{ Write-Output "===========Test At Azure ====Current Time : $(Get-Date)==============" | out-file -FilePath $result -Append -Force }
invoke-command -scriptblock{ nslookup $name | out-file -FilePath $result -Append -Force }
}
Catch
{
} } Start-Sleep -Seconds 600
}
Until ($TimeNow -ge $TimeEnd)
2.编写一个cmd文件来执行这个脚本:
echo Configuring powershell permissions
powershell -c "set-executionpolicy unrestricted" echo start test dns
PowerShell .\testdns.ps1 if %ERRORLEVEL% neq 0 goto error echo SUCCESS
exit /b 0
3.将这2个文件嵌入到程序中,并且都设置"Copy always"属性:
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOcAAAFyCAIAAACBSlozAAAeGUlEQVR4nO2db4wcZ33HeYEq9c+79kVftEhFnbm7YhHZJxApEgGZpBVpvBE5O1QuikhbcUS1ULt3jpOSU3QxZqkdJYfLBLdnAgYfEXHMXcKEy9kmMVnbiWOIz7MmoSQkNou52qrx7N7/O9/0xezMPPPM88zOzO7sPM/4e/oo7M3OPLvsfvzcszu/7/zeY+EHP7L9vMf+H0VRReODH7xpdHS0XC6Xy+XR0dG9e/d+5CM3Z/6sgAiIay0APGAtkA9YC+QD1gL5gLVAPlK3thz5J/PXAsiC0NYWdVMvur8O6GZFKzi/FnVTH2A9on83b6P3Q4wZ8XCCom6aejHrt+0GJ4m1t956W/SdW5prSTULmmGahlawfy1o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FGexGLuvxypeOIsS8JObB8FHU7cSdz+cgnnIpav1KRV0x9xgWU8eCpqK9q39EXp35q3cxjsqrG0qlI6drtwP83v9R13dfkVPQ7ggKsOhoSY4LV7EoFVCNDmKABD1wnZf1fx24/GXVsfVdMZbybHg8HYRTDDXmueiEwjYbE44MICppFM5kuzvypfauqyUTXblImNGFe1UXe77MB2vNkSImJsYnV2lj2AdDjI0OGOYJhv79p01u3moOuRIOy9F1emVIY1ob8ZMhenPlTe1XVXYbkTPpu3kvha1Ff8jGrmTLEtVp+UcYybjLEBsnCaBMyBGbivDZ0PBz4JVuHqDsVdX2ppPWgiUXfvDKsaSozEVo9zTdl0qSMDsoM0yJrcfZP7V7VqSmh0vKsAqei5qdjVcUmiTNliJtPVZeZoyG2gsVd4GHyNq5aWZIDIGB5bmhY7xCmUX5j8L7ziSXqlrr1S9TXa5VzSxDD0IOLduV8VtXxoKxZV+MStb44qc5C6V5V1ZSuaze1AvzzQcKzQmPyvDIuUQMQAd5xq1lmNqJMwbxz2AqbrzNkCETMinFr/CYLPB7IEIiYdeK2XzrAmsDzgAyBiEHcpsH/AV8SHZZaoZK/AAAAAElFTkSuQmCC" alt="" />
4.修改csdef文件,添加启动任务Startup
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="testdnswithsdk26" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2015-04.2.6">
<WebRole name="WebRole1" vmsize="Small">
<Startup>
<Task commandLine="testdns.cmd" executionContext="elevated" taskType="background"/>
</Startup>
<Sites>
<Site name="Web">
<Bindings>
<Binding name="Endpoint1" endpointName="Endpoint1" />
</Bindings>
</Site>
</Sites>
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" />
</ConfigurationSettings>
<Endpoints>
<InputEndpoint name="Endpoint1" protocol="http" port="" />
</Endpoints>
</WebRole>
</ServiceDefinition>
因为测试的powershell脚本要连续执行一段时间,所以需要将任务类型设置为background,否则无法完成部署
云服务程序在启动的时候执行Powershell脚本的更多相关文章
- Jenkins入门之执行Powershell脚本
之前章节提到过powershell,如果需要构建复杂的任务时,使用cmd不是很方便(也可能是由于笔者不太熟悉cmd命令,这里见笑了),这时候powershell就派上用场了,这里并不详细介绍power ...
- 【Azure Developer】调用SDK的runPowerShellScript方法,在Azure VM中执行PowerShell脚本示例
当需要通过代码的方式执行PowerShell脚本时,可以参考以下的示例. Azure SDK中提供了两个方法来执行PowerShell脚本 (SDK Source Code: https://gith ...
- 执行powershell脚本
打开powershell运行窗口: powershell.exe C:\Users\Administrator\Desktop\a.ps1 -a $a. -a $a : vbs脚本路径(如 C:\h ...
- Linux Shell 脚本学习第一天: 使用grep 命令,lsusb, ps -ef, 实现树莓派(Debian OS)时检测到依赖的USB设备启动后,启动终端自动执行shell脚本
1.应用背景: 无人监测的设备,常需要设置应用程序开机启动,程序启动前需要保证调用的设备先启动,运行环境先启动. 2.test.sh部分源码 #!/bin/sh #查看桌面是否启动 while tru ...
- 执行PowerShell脚本的时候出现"在此系 统上禁止运行脚本"错误
使用get-executionpolicy查看当前的脚本执行策略, 默认是Restricted, 也就是不允许任何脚本运行. 此时应该使用set-executionpolicy remotesigne ...
- PowerShell 脚本执行策略
为防止恶意脚本的执行,PowerShell 中设计了一个叫做执行策略(Execution Policy)的东西(我更倾向于把它叫做脚本执行策略).我们可以在不同的应用场景中设置不同的策略来防止恶意脚本 ...
- BSA Network Shell系列-通过NSH执行Powershell,VBScript或bat files脚本
参考:Running Powershell, VBScript, or bat files via NSH 如果你直接在NSH命令行执行的话,可以参考我翻译的下面的东东,如果想运行NSH 脚本作业的话 ...
- powershell脚本执行绕过powershell下脚本执行限制(cmd下执行)以及在cmd下隐藏脚本窗口
powershell脚本执行绕过powershell下脚本执行限制(cmd下执行) powershell脚本运行方式有两种,一种是powshell中运行,另一种是在cmd中(在某些情况下相当有用) p ...
- 使用PowerShell脚本部署定时器到MOSS2010
转:http://www.77site.com/tech/1087042010072906074113_2012050808152911.html 第一章 前言 在此次练习中,您将了解到如何使用Pow ...
随机推荐
- 9.28 Java基本数据类型作业
要求:声明各数据类型变量或常量,赋值并进行输出. 以下为代码: public class SJLX {//公共类 public static void main(String[] args) { // ...
- 函数也是对象,本片介绍函数的属性、方法、Function()狗仔函数。
1.arguments.length表示实参的个数. 2.arguments.callee.length表示形参个数. function test(a,b,c,d,e,f){ alert(argume ...
- 利用SpringAOP 实现 日志输出
目的: 需要对一些事物的操作进行日志记录,如果在service内进行记录,大量的代码重复,并且维护比较麻烦.所以采用AOP的方式对service进行拦截.使用自定义注解的目的则是判断是否需要记录日志和 ...
- Spring mvc-异常javax.servlet.ServletException: Could not resolve view with name 'xxx' in servlet with name 'spring'
最近使用spring mvc开发项目,遇到一个问题: javax.servlet.ServletException: Could not resolve view with name 'ok' in ...
- C#-数据库访问技术 ado.net——创建 数据库连接类 与 数据库操作方法 以及简单的数据的添加、删除、修改、查看
数据库访问技术 ado.net 将数据库中的数据,提取到内存中,展示给用户看还可以将内存中的数据写入数据库中去 并不是唯一的数据库访问技术,但是它是最底层的数据库访问技术 1.创建数据库,并设置主外键 ...
- datatable绑定comboBox显示数据[C#]
实现功能: datatable绑定comboBox,在下拉菜单中显示对应数据 实现方法: 1.生成datatable,并为combox绑定数据源: comboBox1.DataSource = dt1 ...
- [学习笔记]tarjan求割点
都口胡了求割边,就顺便口胡求割点好了QAQ 的定义同求有向图强连通分量. 枚举当前点的所有邻接点: 1.如果某个邻接点未被访问过,则访问,并在回溯后更新 2.如果某个邻接点已被访问过,则更新 对于当前 ...
- css-IE中的border-radius和box-shadow
1.今天遇到一个问题,在给一个图片设置border-radius时,firefox和chrome表现正常,但是在IE中就无效,在IE中必须给图片设置一个边框,比如设置一个透明的边框就可以正常显示. 2 ...
- 如何利用SmartGit将一个已经写好的项目push到github
首先在github上创建一个repository, 然后在SmartGit中 点击有上角的repository然后选择Add or Create...然后点击那个文件夹的图标之后选中自己的项目的问题件 ...
- js 日报 周报 月报 时间扩展 js
当初做统计业务需要处理时间 周报:本周 上周 下周 近一周 月报上月 本月 等 需要使用时间处理 所以扩展了这些方法 <!DOCTYPE html> <html xmlns=&quo ...