How to use Wildcards to exclude Computers

Apr 19, 2013 at 9:49 AM
Hi Kendal,

first of all: Thank you for this great script. It's a huge help.
One thing I did not figure out yet: how can I exclude Computers when querying a domain?
I have several different machines to exclude (Exchange, FileServer, AppServer and so on).
Since the naming convention looks like this: yyyFSxx (a file server in that case) I need to set two wildcards for one type of computer.
So my exclusion list looks like this -ExcludeComputerName fs, ex, as
But then I get an error "AmbigousParameterSet"

Any ideas? Otherwise I will create a list of Computers first an paste this list into the script call.

Regards
Dirk
Coordinator
Apr 21, 2013 at 12:05 AM
Dirk,
Can you provide all the parameters that you're using to run the scripts? I'd like to try and reproduce the problem that you're seeing.

To answer your question as best as I can for now, the ExcludeComputerName parameter will accept wildcards, so if you wanted to exclude anything with fs, ex, or as in the name it would look like:
.\Get-SqlServerInventoryToClixml.ps1 -DnsServer automatic -ExcludeComputerName '*fs*','*as*','*ex*'
Also, the ExcludeComputerName parameter must be used in combination with either the -DnsServer or -Subnet parameters.

Kendal
Apr 21, 2013 at 12:15 AM
Hi Kendal,

I will run another test on Monday.
As far as I remember, I have used the syntax you have given in your example. But I'll check.

Regards
Dirk




kendalvandyke <[email removed]> schrieb:

From: kendalvandyke

Dirk,
Can you provide all the parameters that you're using to run the scripts? I'd like to try and reproduce the problem that you're seeing.

To answer your question as best as I can for now, the ExcludeComputerName parameter will accept wildcards, so if you wanted to exclude anything with fs, ex, or as in the name it would look like:
.\Get-SqlServerInventoryToClixml.ps1 -DnsServer automatic -ExcludeComputerName '*fs*','*as*','*ex*'
Also, the ExcludeComputerName parameter must be used in combination with either the -DnsServer or -Subnet parameters.

Kendal

--
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.
Apr 23, 2013 at 3:12 PM
Hi Kendal,

I got the following error:
C:\Users\MyUser\Documents\WindowsPowerShell\Get-SqlServerInventoryToClixml.ps1 : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:37
+ .\Get-SqlServerInventoryToClixml.ps1 <<<<  -DnsServer 10.250.132.190 -ExcludeComputerName '*fs*', '*as*', '*ex*'
    + CategoryInfo          : InvalidArgument: (:) [Get-SqlServerInventoryToClixml.ps1], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,Get-SqlServerInventoryToClixml.ps1
The script call was:
.\Get-SQLServerInventoryToClixml.ps1 -DnsServer www.xxx.yyy.zzz -ExcludeComputerName '*fs*','*as*','*ex*'  
Did not want to paste the real IP, therefore the wwxxyyzz stuff

If I try to use the name of a DNSServer (namingconvention is yyyBDCzzz, then I get the following error:
C:\Users\MyUser\Documents\WindowsPowerShell\Get-SqlServerInventoryToClixml.ps1 : Cannot validate argument on parameter 'DnsServer'. The argument
"yyybdczzz" does not match the "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.)
{3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$|^auto$|^automatic$" pattern. Supply an argument that matches 
"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$|^auto$|^automatic$" 
and try the command again.
At line:1 char:48
+ .\Get-SqlServerInventoryToClixml.ps1 -DnsServer <<<<  849bdc999 -ExcludeCompu,terName '*fs*', '*as*', '*ex*'
    + CategoryInfo          : InvalidData: (:) [Get-SqlServerInventoryToClixml.ps1], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Get-SqlServerInventoryToClixml.ps1
Dirk
Coordinator
Apr 23, 2013 at 8:44 PM
Dirk,
I've reproduced the problem on my test VMs and am working on a fix. Should have something posted in the next day or two.

Kendal
Coordinator
Apr 24, 2013 at 8:04 AM
Dirk,
I've released version 1.0.1.0 which fixes the parameter name set resolution problem you're having. (Thanks for reporting it!)

Let me know if you're still having the problem or run into anything else that I can help with!
  • Kendal
Apr 24, 2013 at 8:57 AM
Wow,

that's awesome.
I'll check in a few minutes. Thanks for the support.