Explain the param() block of the Get-SQLServerPrivileges function ?
Answer
. At the start of the function, we supply a parameter with the name of the SQL Server instance, and call the Load-Assembly function with the name of the assembly:
param
(
[Parameter(Mandatory = $true, Position=1)]
[ValidateNotNullOrEmpty()]
[string]$inst = $null
)
# Check if assembly is loaded
Load-Assembly -name 'Microsoft.SqlServer.SMO'
Tags
#Agile #Docs #Powershell #SQL
Question
Explain the param() block of the Get-SQLServerPrivileges function ?
Answer
?
Tags
#Agile #Docs #Powershell #SQL
Question
Explain the param() block of the Get-SQLServerPrivileges function ?
Answer
. At the start of the function, we supply a parameter with the name of the SQL Server instance, and call the Load-Assembly function with the name of the assembly:
param
(
[Parameter(Mandatory = $true, Position=1)]
[ValidateNotNullOrEmpty()]
[string]$inst = $null
)
# Check if assembly is loaded
Load-Assembly -name 'Microsoft.SqlServer.SMO'
If you want to change selection, open document below and click on "Move attachment"
Documenting SQL Server with PowerShell - Simple Talk rRoles}} | Sort-Object Name } # Clear the array $serverRoles = @() } } return $result } Listing 2: Get-SQLServerPrivileges For those of you who are new to PowerShell, let’s step through the code<span>. At the start of the function, we supply a parameter with the name of the SQL Server instance, and call the Load-Assembly function with the name of the assembly: 1 2 3 4 5 6 7 8 9 param ( [Parameter(Mandatory = $true, Position=1)] [ValidateNotNullOrEmpty()] [string]$inst = $null ) # Check if assembly is loaded Load-Assembly -name 'Microsoft.SqlS
Summary
status
not learned
measured difficulty
37% [default]
last interval [days]
repetition number in this series
0
memorised on
scheduled repetition
scheduled repetition interval
last repetition or drill
Details
No repetitions
Discussion
Do you want to join discussion? Click here to log in or create user.