@@ -73,15 +73,13 @@ Param(
7373 [ValidateSet (' Midnight' , ' Yesterday' , ' LastWeek' , ' LastMonth' )]
7474 [string ]$Since ,
7575 [int ]$ConnectionTimeout = 30 ,
76- [string ]$Properties = " Name,Status,Size,SpaceAvailable,Owner,LastBackupDate,LastLogBackupDate,IsUpdateable,DefaultFileGroup,AutoShrink,ActiveConnections"
76+ [ValidateSet (' *' , ' Name' , ' Status' , ' Size' , ' SpaceAvailable' , ' Owner' , ' LastBackupDate' , ' LastLogBackupDate' , ' IsUpdateable' , ' DefaultFileGroup' , ' AutoShrink' , ' ActiveConnections' )]
77+ [string []]$Properties = @ (' Name' , ' Status' , ' Size' , ' SpaceAvailable' , ' Owner' , ' LastBackupDate' , ' LastLogBackupDate' , ' IsUpdateable' , ' DefaultFileGroup' , ' AutoShrink' , ' ActiveConnections' )
7778)
7879
7980Import-Module SQLServer
8081
8182try {
82- if ([System.String ]::IsNullOrWhiteSpace($Properties )){
83- $Properties = ' *'
84- }
8583 $instance = GetSQLServerInstance - ServerInstance $ServerInstance - ServerCredential $ServerCredential - ConnectionTimeout $ConnectionTimeout
8684
8785 [hashtable ]$cmdArgs = @ {' ErrorAction' = ' Stop'
@@ -106,13 +104,13 @@ try{
106104 $cmdArgs.Add (" Since" , $Since )
107105 }
108106
109- $Script : result = Get-SqlBackupHistory @cmdArgs | Select-Object *
107+ $result = Get-SqlBackupHistory @cmdArgs | Select-Object $Properties
110108
111109 if ($SRXEnv ) {
112- $SRXEnv.ResultMessage = $Script : result
110+ $SRXEnv.ResultMessage = $result
113111 }
114112 else {
115- Write-Output $Script : result
113+ Write-Output $result
116114 }
117115}
118116catch {
0 commit comments