0

PowerShell をスクリプト化して、すべての AD コンピューターにアクセスし、共有のリストを取得しようとしています。Get-WMIObject で奇妙な動作が見られます。

スクリプト:

Import-Module ActiveDirectory

$Computers = Get-ADComputer -Filter * -SearchBase "Some OU" |
    Where-Object {
        $_.Name -match "-LT$" -or
        $_.Name -match "-PC$" -or
        $_.Name -match "-VPC$" 
    } |
    Select-Object Name -ExpandProperty Name |
    Sort

$Computers | ForEach-Object {
    Write-Host $_
    Write-Host "========================="
    Get-WMIObject -Class Win32_Share -Computer $_ 
}

通常、gwmi コマンドからの出力は次のようになります。

Name       Path          Description
----       ----          -----------
ADMIN$     C:\Windows    Remote Admin
C$         C:\           Default share
IPC$                     Remote IPC

しかし、代わりに、同じコンピューターに対して次の出力が得られます。

...

[Computername]
=========================
Name   Path                              Description
----   ----                              -----------
ADMIN$ C:\WINDOWS                        Remote Admin
C$     C:\                               Default share
IPC$                                     Remote IPC
print$ C:\WINDOWS\system32\spool\drivers Printer Drivers
ADMIN$ C:\WINDOWS                        Remote Admin
C$     C:\                               Default share
IPC$                                     Remote IPC
print$ C:\WINDOWS\system32\spool\drivers Printer Drivers
ADMIN$ C:\Windows                        Remote Admin
C$     C:\                               Default share
IPC$                                     Remote IPC

...

これら 2 つの出力は、同じコンピューターからのものです。コンピューター名の一覧も出力しており、コンピューターの欠落もしていないので、それらが合わさったものではないと思います。

手がかりはありますか?

4

0 に答える 0