Answer the question
In order to leave comments, you need to log in
Get-WmiObject why does not work correctly?
There is a script:
$computers = Get-Content -Path C:\temp\foo.csv
Get-WmiObject -ComputerName $computers -Class Win32_UserAccount -Filter "LocalAccount=True" | Select PSComputername, Name, Status, Disabled, AccountType, Lockout, PasswordRequired, PasswordChangeable | Out-GridView
Get-WmiObject : Сервер RPC недоступен.
строка:2 знак:1
+ Get-WmiObject -ComputerName $computers -Class Win32_UserAccount -Filt ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], COMException
+ FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
Get-WmiObject -ComputerName <b>PSname</b> -Class Win32_UserAccount -Filter "LocalAccount=True" | Select PSComputername, Name, Status, Disabled, AccountType, Lockout, PasswordRequired, PasswordChangeable | Out-GridView
Answer the question
In order to leave comments, you need to log in
I don’t know what specifically helped, but I did the following:
1) Registered FQDN server names
2) Removed empty lines (on the list and 2000 entries, for some reason there were about 5 empty lines)
Get-WmiObject in ForEach should be when there is an array of data in the variable
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question