MKServerBuilder.psm1

  1. function Test-ElevatedShell
  2. {
  3. $user = [Security.Principal.WindowsIdentity]::GetCurrent()
  4. (New-Object Security.Principal.WindowsPrincipal $user).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
  5. }
  6.  
  7. if(!(Test-ElevatedShell))
  8. {
  9.  
  10. $warning=@"
  11. To run commands exposed by this module on Windows Vista, Windows Server 2008, and later versions of Windows,
  12. you must start an elevated Windows PowerShell console. You must have Administrator privligies on the remote
  13. computers and the remote registry service has to be running.
  14. "@
  15.  
  16. Write-Warning $warning
  17. Exit
  18. }
  19.  
  20. # dot-source all function files
  21. Get-ChildItem -Path $PSScriptRoot\*.ps1 | Foreach-Object{ . $_.FullName }
  22.  
  23. # Export all commands except for Test-ElevatedShell
  24. Export-ModuleMember Function @(Get-Command Module $ExecutionContext.SessionState.Module | Where-Object {$_.Name -ne "Test-ElevatedShell"})

MKServerBuilder.psm1的更多相关文章

  1. MKServerBuilder.psd1

    MKServerBuilder.psd1 # # Module manifest for module 'MKServerBuilder' # # Generated by: Edward Guan ...

  2. Restart-ServiceEx.psm1

    详细描述 利用WMI的Win32_Service类重启指定计算机上的服务. Restart-ServiceEx cmdlet 通过WMI的Win32_Service类向指定计算机(ComputerNa ...

  3. Code First 迁移,及迁移错误

    迁移错误: 今天在使用EF6 Code First时,出现如下错误,折腾了老半天.分享一下,帮后面的兄弟少走弯路. PM> Enable-Migrations Checking if the c ...

  4. EntityFramework 7 开发纪录

    博文目录: 暂时开发模式 Code First 具体体现 DbContext 配置 Entity 映射关联配置 Migration 问题纪录(已解决) 之前的一篇博文:EF7 Code First O ...

  5. powershell脚本,命令行参数传值,并绑定变量的例子

    这是小技巧文章,所以文章不长.但原创唯一,非常重要.我搜了下,还真没有人发 powershell怎样 [命令行 参数 绑定],所以我决定写成博客. 搜索关键字如下: powershell 命令行 参数 ...

  6. 【转】PowerShell入门(十一):编写脚本模块

    转至:http://www.cnblogs.com/ceachy/archive/2013/03/08/PowerShell_Script_Module.html 现在通过编写模块就可以在PowerS ...

  7. 使用powershell提权的一些技巧

    原文:http://fuzzysecurity.com/tutorials/16.html 翻译:http://www.myexception.cn/windows/1752546.html http ...

  8. Import-Module ServerManager Import-Module : 未能加载指定的模块“ServerManager”,因为在任何模块目录中都没有找到有效模块文件...(通过Setup Factory调用PowerShell的脚本)

    操作系统: Windows server 2008 R2(64位) C:\Windows\System32\WindowsPowerShell\v1.0\Modules 下有ServerManager ...

  9. 下载和使用 Open XML PowerTools

    安装 Open XML SDK 2.5 首先,需要安装 Open XML SDK 2.5 ,从这个地址下载安装程序:http://www.microsoft.com/en-in/download/de ...

随机推荐

  1. 练习生产者与消费者-PYTHON多线程中的条件变量同步-Queue

    以前练习过,但好久不用,手生,概念也生了, 重温一下.. URL: http://www.cnblogs.com/holbrook/tag/%E5%A4%9A%E7%BA%BF%E7%A8%8B/ ~ ...

  2. 如何在C++中使用WebService

    gsoap主页 http://sourceforge.net/projects/gsoap2   使用gsoap生成所需的WebService 下载后的gsoap包为:(点击到我的资源中下载) 将他解 ...

  3. Markdown各种小问题汇总

    如何分割Quote? How can I write two separate blockquotes in sequence using markdown? > Imagination is ...

  4. oracle时间模型

    Oracle在9i或者早期的版本,对于性能优化方面,主要采用命中率模型,后面的版本,也保留着命中率模型,比如在awr报告中,Instance Efficiency Percentages (Targe ...

  5. 【原】现有市场上H264 IPCamerad的功能

    网络: 1.内置Web Server,通过IE实现远程监看.控制.设置等操作: 2.支持UPnP路由器,自动配置端口映射: 3.支持DDNS(动态域名解析).PPPoE拨号.DHCP网络协议: 4.支 ...

  6. 水leetcode 爬楼梯

    public class Solution { public int climbStairs(int n) { if(n==1) return 1; if(n==2) return 2; int pr ...

  7. C#开发移动平台iOS、Android 与Windows

    1.Xamarin http://www.csdn.net/article/2014-02-28/2818585-Xamarin-CSDN-mobile-develop

  8. Web 应用性能和压力测试工具 Gor - 运维生存时间

    Web 应用性能和压力测试工具 Gor - 运维生存时间 undefined 无需花生壳,dnspod实现ddns - 推酷 undefined

  9. 使用GSoap开发WebService客户端与服务端

    Gsoap 编译工具提供了一个SOAP/XML 关于C/C++ 语言的实现, 从而让C/C++语言开发web服务或客户端程序的工作变得轻松了很多. 用gsoap开发web service的大致思路 我 ...

  10. poj 3608 Bridge Across Islands

    题目:计算两个不相交凸多边形间的最小距离. 分析:计算几何.凸包.旋转卡壳.分别求出凸包,利用旋转卡壳求出对踵点对,枚举距离即可. 注意:1.利用向量法判断旋转,而不是计算角度:避免精度问题和TLE. ...