on-internet
← Community

How to run Powershell on a list of computers (get-wmiobject SoftwareLicensingProduct)

Stack Overflow ·

I'm trying to run a remote command on a list of computers that available in plain text file (1 computer per line) in a file named 1.txt available under c:\1\1.txt. What I run the powershell script the variable $comp is being run as $comp instead of being changed to the computer name $computers = Get-Content c:\1\1.txt foreach ($comp in $computers){ $LicenseInfo = Get-WmiObject SoftwareLicensingProduct -ComputerName $comp | Where-Object { $_.partialProductKey -and $_.ApplicationID -eq "55c92734-d682-4d71-983e-d6ec3f16059f" } | Select-Object PartialProductKey, Description, ProductKeyChannel, @{

Comments

Sign in or sign up to comment and upvote.

No comments yet.