摘要: foreach-object 对列表中每个对象进行操作where-object 将列表中没个对象根据{}内条件筛选后直接输出例:get-service | foreach-object {if($_.Name -like "B*") {$_}}作用的等同于get-service | where-object {$_.name -like "B*"}-------------------------------------------------------ps:powershell中的变量是大小写不敏感的 阅读全文
posted @ 2012-12-28 13:58 EthanChou 阅读(540) 评论(0) 推荐(0)
摘要: 今天碰到需要暂停service才能继续restore SEPM的database的情况,用了两种方式去stop service:1 powershell: stop-service 这时可能会出现 当前服务被其他服务所依赖 这用情况下使用stop-service -force servicename 的方式能够停掉service(有warning)但是会出现server connection failed的情况2 cmd: net stop servicename 这种方式可以成功停掉服务并没有waring 之后就一切正常了总结:-force 是有隐患的 虽然可以停掉服务及时服务有depend 阅读全文
posted @ 2012-12-19 21:36 EthanChou 阅读(351) 评论(0) 推荐(0)
摘要: PowerShell 默认不允许执行ps1脚本文件错误信息:C:\Desktop\prac.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get- help about_signing" for more details.At line:1 char:19解决方法:可以通过Get-ExecutionPolicy,来取得当前策略。用Set-ExecutionPolicy设置当前策略。在PowerShell中的执行Policy的有效参数: 阅读全文
posted @ 2012-12-18 21:31 EthanChou 阅读(1551) 评论(0) 推荐(0)
摘要: linux 目录结构简介 阅读全文
posted @ 2012-12-03 20:57 EthanChou 阅读(270) 评论(0) 推荐(0)