小编sof*_*fun的帖子

在 Windows Server 2012 上安装 Active Directory PowerShell 模块

我需要在 Windows Server 2012 上安装 AD PowerShell 模块,但我无法承受服务器在工作时间重启。

我的问题是可以通过添加/删除 Windows 功能安装 AD 模块而不需要重新启动吗?

如果是这样,PowerShell 需要(最少)哪些 AD 模块才能运行此命令

Search-ADAccount -LockedOut
Run Code Online (Sandbox Code Playgroud)

powershell active-directory windows-server-2012-r2

7
推荐指数
1
解决办法
1万
查看次数

如何使用 PowerShell 捕获异常

我收到此错误。

Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
At F:\Code\powershell\network_shutdown\TurnNetworkOff.ps1:19 char:26
+             Get-WmiObject <<<<  -computername $computer Win32_NetworkAdapter -filter "AdapterTypeId
=0" | % {
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMException
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
Run Code Online (Sandbox Code Playgroud)

这是我的代码

#Define variables used in this script
$namespace = "root\WMI"

$array = @()
$exceptionarray = @()

$computerlist = Get-Content F:\Code\powershell\network_shutdown\computer-list.csv

foreach ($computer in $computerlist) 
{
    # Main Processing Section
    # Write-Host $computer
    if((Test-Connection -Cn $computer -BufferSize 16 -Count 1 -ea 0 -quiet)) …
Run Code Online (Sandbox Code Playgroud)

powershell logging

5
推荐指数
1
解决办法
1万
查看次数