首页 > 其他 > 详细

MKServerBuilder.psm1

时间:2014-01-31 14:27:29      阅读:422      评论:0      收藏:0      [点我收藏+]

MKServerBuilder.psm1

bubuko.com,布布扣
function Test-ElevatedShell
{
    $user = [Security.Principal.WindowsIdentity]::GetCurrent()
    (New-Object Security.Principal.WindowsPrincipal $user).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
}


if(!(Test-ElevatedShell))
{

$warning=@"
    To run commands exposed by this module on Windows Vista, Windows Server 2008, and later versions of Windows,
    you must start an elevated Windows PowerShell console. You must have Administrator privligies on the remote
    computers and the remote registry service has to be running.
"@

    Write-Warning $warning    
    Exit
}

# dot-source all function files
Get-ChildItem -Path $PSScriptRoot\*.ps1 | Foreach-Object{ . $_.FullName }

# Export all commands except for Test-ElevatedShell
Export-ModuleMember –Function @(Get-Command –Module $ExecutionContext.SessionState.Module | Where-Object {$_.Name -ne "Test-ElevatedShell"})
bubuko.com,布布扣

MKServerBuilder.psm1

原文:http://www.cnblogs.com/edward2013/p/3536737.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!