search
Categories
Sponsors
VirtualMetric Hyper-V Monitoring, Hyper-V Reporting
Archive
Blogroll

Badges
MCSE
Community

Cozumpark Bilisim Portali
Posted in Windows Powershell | No Comment | 1,000 views | 04/03/2016 14:19

You can get detailed info about SQL Server Role properties via following code:

1
2
3
4
5
6
7
8
9
10
11
$MSSQLServerManager = New-Object 'Microsoft.SqlServer.Management.SMO.Server'
 
# Get SQL Roles
$MSSQLRoles = @($MSSQLServerManager.Roles)[0]
 
# Get SQL Logins Properties
$HostSQLRoleName = $MSSQLRoles.Name;
$HostSQLOwner = $MSSQLRoles.Owner;
$HostSQLIsFixedRole = $MSSQLRoles.IsFixedRole;
$HostSQLCreateDate = $MSSQLRoles.DateCreated;
$HostSQLDateLastModified = $MSSQLRoles.DateModified;

You can also check other properties by listing all properties of $MSSQLRoles.


Posted in Windows Powershell | 2 Comments | 1,232 views | 02/03/2016 16:12

You can get detailed SQL Server properties via following code:

1
2
3
4
5
6
7
8
9
10
11
12
13
$MSSQLServerManager = New-Object 'Microsoft.SqlServer.Management.SMO.Server'
 
# Get SQL Logins
$MSSQLLogin = @($MSSQLServerManager.Logins)[0]
 
# Get SQL Logins Properties
$HostSQLLoginName = $MSSQLLogin.Name;
$HostSQLLoginType = $MSSQLLogin.LoginType;
$HostSQLLanguage = $MSSQLLogin.Language;
$HostSQLHasAccess = $MSSQLLogin.HasAccess;
$HostSQLDenyWindowsLogin = $MSSQLLogin.DenyWindowsLogin;
$HostSQLIsDisabled = $MSSQLLogin.IsDisabled;
$HostSQLIsLocked = $MSSQLLogin.IsLocked;

You can also check other properties by listing all properties of $MSSQLLogin.