itglue / automation

A place for IT Glue's user community to learn ways of automating their documentation.
Apache License 2.0
99 stars 33 forks source link

File Shares Script Fails #9

Open bdawson9 opened 6 years ago

bdawson9 commented 6 years ago

I get the following error message when running the File Shares powershell script:

Exception calling "Matches" with "2" argument(s): "Value cannot be null. Parameter name: input" At C:\scripts\file shares\FileShares.ps1:176 char:5

CalebAlbers commented 5 years ago

(troubleshooting via email)

jasconv commented 5 years ago

Hi Caleb,

I am also receive the exact same error as bdawson9 reported. Please let me know if you have found a solution or if you need me to help with troubleshooting.

Thanks!

Jason

theonlytruebigmac commented 5 years ago

Was there any update on this?

elanasparkle commented 5 years ago

I have the same issue did anyone have anything that could help.

elanasparkle commented 5 years ago

I found out the issue When there ins't any shares on that machine the $files variable is blank therefore the Regex can't compare anything because if you take the -filter out the script works great.

$Files = gwmi -Class win32share -ComputerName $computer | Where-Object{$.Name -NotMatch "^print|^NETLOGON|^MTATempStore|^prnproc"}