Passing input variable from PowerShell form to cmdlet argument results in blank data Passing input variable from PowerShell form to cmdlet argument results in blank data powershell powershell

Passing input variable from PowerShell form to cmdlet argument results in blank data


Your Get-ADComputer filter syntax is broken

Change it to :

Get-ADComputer -filter "name -like '$global:x*' -and Enabled -eq 'true'" | Select -expand Name | out-file C:\Users\Admin1\Desktop\computers.txt 

And your script will work.

The article you followed is very out of date - there is discussion of what's wrong with it, and new updated examples from 2014 on The Scripting Guys' blog here