So I went to a powershell class last week and now I'm trying to put to use some of what I learned last week.
I am trying to use the param feature and the first step is to start with a working command, which I have.
Get-ADComputer -Filter {description -like "*kelly*"} -Properties name,description,operatingsystem | select name,description,operatingsystem | Format-Table -AutoSize
Produces this on the screen:
name description operatingsystem
---- ----------- ---------------
DMV22564 DMV - Cashiers - Kelly Lawrence Windows 7 Professional
ADM23169 ADM - Information Technology - Kevin Kelly Windows 7 Professional
PDD23113 PDD - Roadway Traffic & Safety - Joseph Kelly Windows 7 Professional
But when I use the script below I don't get any Output to the screen. I am prompted to enter the description but after I do that and run the script nothing shows up on the screen.
Any help would be appreciated.
Thanks,
Andy
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True)]
[string]$Description
)
Get-ADComputer -Filter {description -like "*$Description*"} -Properties name,description,operatingsystem | select name,description,operatingsystem | Format-Table -AutoSize