The Multifunctioning DBA

Oct 19 2011   1:16PM GMT

Powershell Disable db File Autogrow

Colin Smith Colin Smith Profile: Colin Smith

In order to Disable autogrow on your database files it is a bit tricky. One would think that in SMO you would have an autogrow flag that could be turned on and off like there is in the GUI. Well this is not the case. So if you take my script fromĀ http://itknowledgeexchange.techtarget.com/dba/powershell-script-to-change-data-and-log-files-that-are-growing-by-percent/
and make a little bit of a change then the autogrow will be turned off.
Just set the Growth to 0 and most important is to change the growthtype to none:
$file.growth = 0
$file.growthtype = “none”
$file.alter()
That is it and then when you look in the GUI autogrow will be off.

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: