1
PowerShell的新人在這裏...
如果我輸出到屏幕這樣的:
foreach($databasePermission in $database.EnumDatabasePermissions($user.Name))
{
Write-Host $databasePermission.PermissionState $databasePermission.PermissionType "TO" $databasePermission.Grantee
}
我得到這個,這是我想要的:
Grant CONNECT TO dbo
但是,如果我嘗試輸出到像這樣的文本文件:
foreach($databasePermission in $database.EnumDatabasePermissions($user.Name))
{
"$databasePermission.PermissionState $databasePermission.PermissionType TO $databasePermission.Grantee" | Out-File $filename
}
個
我的結果重複這樣的:
[dbname] Database: cust_serv, Grant, CONNECT.PermissionState [dbname] Database: cust_serv, Grant, CONNECT.PermissionType TO [dbname] Database: cust_serv, Grant, CONNECT.Grantee
謝謝!
謝謝!!!!!! –