8
8
"context"
9
9
"fmt"
10
10
"log/slog"
11
- "path"
11
+ "path/filepath "
12
12
"strings"
13
13
14
14
"github.com/kolide/launcher/ee/allowedcmd"
@@ -42,11 +42,11 @@ func (t *Table) generate(ctx context.Context, queryContext table.QueryContext) (
42
42
return nil , fmt .Errorf ("kolide_ntfs_ads_zone_id requires at least one path to be specified" )
43
43
}
44
44
45
- for _ , p := range paths {
45
+ for _ , path := range paths {
46
46
for _ , dataQuery := range tablehelpers .GetConstraints (queryContext , "query" , tablehelpers .WithDefaults ("*" )) {
47
47
var output bytes.Buffer
48
- if err := tablehelpers .Run (ctx , t .slogger , 30 , allowedcmd .Powershell , []string {"Get-Content" , "-Path" , path .Clean (p ), "-Stream" , "Zone.Identifier" }, & output , & output ); err != nil {
49
- t .slogger .Log (ctx , slog .LevelInfo , "failure running powershell get-content command" , "err" , err , "path" , p )
48
+ if err := tablehelpers .Run (ctx , t .slogger , 30 , allowedcmd .Powershell , []string {"Get-Content" , "-Path" , filepath .Clean (path ), "-Stream" , "Zone.Identifier" , "-ErrorAction" , "Ignore " }, & output , & output ); err != nil {
49
+ t .slogger .Log (ctx , slog .LevelInfo , "failure running powershell get-content command" , "err" , err , "path" , path )
50
50
continue
51
51
}
52
52
@@ -62,7 +62,7 @@ func (t *Table) generate(ctx context.Context, queryContext table.QueryContext) (
62
62
}
63
63
64
64
rowData := map [string ]string {
65
- "path" : p ,
65
+ "path" : path ,
66
66
}
67
67
68
68
results = append (results , dataflattentable .ToMap (flattened , dataQuery , rowData )... )
0 commit comments