1
kudos
spam Kudos Remove

Use the Best Tool for the Task

published 987 days, 19 hours, 29 minutes ago posted by sasa 993 days, 18 hours, 31 minutes ago
Tuesday, September 08, 2009 12:27:56 PM GMT Wednesday, September 02, 2009 1:25:34 PM GMT

Last February I wrote an article for Simple-Talk called Let PowerShell do an Inventory of your Servers. This script was useful to me then, and it continues to be so, but it recently ran into a glitch.

Here is the code in the script to gather data on each file used by a database:$fgs = $db.FileGroups foreach ($fg in $fgs) { $files = $fg.Files $outnm = ".\" + $svr + "\" + $instnm + $dbtype + "" + $dbname + "DataFiles.csv" $files | select $db.Name, Name, FileName, Size, UsedSpace | export-csv -...

category: Management | clicked: 1 | | source: sqlblog.com | show counter code
tags: PowerShell, SMO

No comments yet, be the first one to post comment.

To post your comment please login or signup