The error I'm getting is "Invoke-Sqlcmd : Operand type clash: varchar is incompatible with DBStatsTable"
DBStatsTable is my user defined table type. Whenever I do a get-member on $DBStats it's coming back as an array object so I'm not sure why it's being passed in as a varchar.
Edit: I could also pass in an XML data type but I'm not having any luck that way either.
It is telling you the value you are passing does not match with the datatype expected on the db side:
you need to look at the ddl for your table and verify the datatype you are passing into dbstats then simply use powershell to convert the string to that datatype before passing into your invoke-sql
Not much else I can offer without knowing the design of the table, but that seems to be a likely culprit.
Managing Active Directory does not always have to be complicated. If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why
you need to look at the ddl for your table and verify the datatype you are passing into dbstats then simply use powershell to convert the string to that datatype before passing into your invoke-sql
Not much else I can offer without knowing the design of the table, but that seems to be a likely culprit.