spjeff / sppatchify

SharePoint Patchify - centralized tool to apply CU patch to entire farm from one console
MIT License
1 stars 0 forks source link

mounting content fails when there was only one database #27

Closed malterad closed 4 years ago

malterad commented 4 years ago

I had the rather uncommon situation, that my farm contained only one content database before patching. In that case, when SPPatchify imports the csv, Import-Csv returns an object rather than an array. (which causes the iteration to iterate through the object properties rather the array items plus calculating the percentage fails with a 'division by zero' as $db.Count is undefined).

I suggest the following fix (which ensures that $dbs is always an array): $dbs = @() $dbs += Import-Csv $files.Fullname

spjeff commented 4 years ago

Excellent suggestion.

Updated PS1 and commit done.

https://github.com/spjeff/sppatchify/commit/2fddbfac85bcb83ea65dcda2b91e99214efdbf23#diff-5918760c8d2458204dcbb74d9364e7d7