How to Manage DB Files (a large number of files) in a Database with Powershell?

# Step 1 - In our example, we have only one filegroup and file. We need to assume multiple FGs and multiple Files to see the advantage
PS SQLSERVER:\sql\xu-acer-pc\default\databases\adventureworks2014\Filegrojups\Primary\files> dir | gm 
PS SQLSERVER:\sql\xu-acer-pc\default\databases\adventureworks2014\Filegrojups\Primary\files> gci | ft name,growth, growthtype -autosize

# Step 2 - now let's change the growth to None
# Option 1: Using GrowthType property
PS SQLSERVER:\sql\xu-acer-pc\default\databases\adventureworks2014\filegroups\primary\files> dir | %{$_.GrowthType="None"; $_.Alter()}

# Option 2: Using Set_GrowthType() method. This method is not displayed with gm, but displayed with "gm -force" since PS 2.0


PS SQLSERVER:\sql\xu-acer-pc\default\databases\adventureworks2014\filegroups\primary\files> dir | %{$_.Set_GrowthType("None"); $_.Alter()}