This project is read-only.

Add-SqlFileGroup returns error

May 25, 2012 at 6:16 PM

I'm trying to use the Add-SqlFileGroup to add a filegroup to a database.  When I make the call:

$name = 'FileGroupxxx'$database = Get-SqlDatabase "US0680NB\SQL2008DEV" "AdventureWorks2008R2" Add-SqlFileGroup -database $database -name $name$database.Alter()

I get:

To accomplish this action, set property ID.At :line:0 char:0

I've been trying to figure out where the error is.  I've copied the function from the SQLServer.psm1 to the .ps1 script I'm working in and it works fine.

Any ideas on what I'm doing or how to continue troubleshooting this issue?



May 26, 2012 at 7:17 PM

I'm not sure I'm able to run the following code on my machine fine:

import-module sqlserver
$name = 'FileGroupxxx'
$database = Get-SqlDatabase "$env:computername\SQL1" "AdventureWorksLT2008R2" 
Add-SqlFileGroup -database $database -name $name