Do you want BuboFlash to help you learning these things? Or do you want to add or correct something? Click here to log in or create user.



Tags
#Agile #Docs #Powershell #SQL
Question
How to load Load-Assembly ?
Answer
function Load-Assembly
		{
		    <# 
		    .SYNOPSIS
		        Check if a assembly is loaded and load it if necessary
		    .DESCRIPTION
		        The script will check if an assembly is already loaded.
		        If it isn't already loaded it will try to load the assembly
		    .PARAMETER  name
		        Full name of the assembly to be loaded
		    .EXAMPLE
		        Load-Assembly -name 'Microsoft.SqlServer.SMO'
		    .INPUTS
		    .OUTPUTS
		    .NOTES
		    .LINK
		    #>
		     param(
		          [Parameter(Mandatory = $true)][ValidateNotNullOrEmpty()]
		          [String] $name
		     )
		     
		     if(([System.AppDomain]::Currentdomain.GetAssemblies() | where {$_ -match $name}) -eq $null)
		     {
		        try{
		            [System.Reflection.Assembly]::LoadWithPartialName($name) | Out-Null
		        } 
		        catch [System.Exception]
		        {
		            Write-Host "Failed to load assembly!" -ForegroundColor Red
		            Write-Host "$_.Exception.GetType().FullName, $_.Exception.Message" -ForegroundColor Red
		        }
		     }
	} 


Tags
#Agile #Docs #Powershell #SQL
Question
How to load Load-Assembly ?
Answer
?

Tags
#Agile #Docs #Powershell #SQL
Question
How to load Load-Assembly ?
Answer
function Load-Assembly
		{
		    <# 
		    .SYNOPSIS
		        Check if a assembly is loaded and load it if necessary
		    .DESCRIPTION
		        The script will check if an assembly is already loaded.
		        If it isn't already loaded it will try to load the assembly
		    .PARAMETER  name
		        Full name of the assembly to be loaded
		    .EXAMPLE
		        Load-Assembly -name 'Microsoft.SqlServer.SMO'
		    .INPUTS
		    .OUTPUTS
		    .NOTES
		    .LINK
		    #>
		     param(
		          [Parameter(Mandatory = $true)][ValidateNotNullOrEmpty()]
		          [String] $name
		     )
		     
		     if(([System.AppDomain]::Currentdomain.GetAssemblies() | where {$_ -match $name}) -eq $null)
		     {
		        try{
		            [System.Reflection.Assembly]::LoadWithPartialName($name) | Out-Null
		        } 
		        catch [System.Exception]
		        {
		            Write-Host "Failed to load assembly!" -ForegroundColor Red
		            Write-Host "$_.Exception.GetType().FullName, $_.Exception.Message" -ForegroundColor Red
		        }
		     }
	} 

If you want to change selection, open document below and click on "Move attachment"

Documenting SQL Server with PowerShell - Simple Talk
d the assembly name will load SMO, and any other kind of assembly, assuming it’s not already loaded. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 <span>function Load-Assembly { <# .SYNOPSIS Check if a assembly is loaded and load it if necessary .DESCRIPTION The script will check if an assembly is already loaded. If it isn't already loaded it will try to load the assembly .PARAMETER name Full name of the assembly to be loaded .EXAMPLE Load-Assembly -name 'Microsoft.SqlServer.SMO' .INPUTS .OUTPUTS .NOTES .LINK #> param( [Parameter(Mandatory = $true)][ValidateNotNullOrEmpty()] [String] $name ) if(([System.AppDomain]::Currentdomain.GetAssemblies() | where {$_ -match $name}) -eq $null) { try{ [System.Reflection.Assembly]::LoadWithPartialName($name) | Out-Null } catch [System.Exception] { Write-Host "Failed to load assembly!" -ForegroundColor Red Write-Host "$_.Exception.GetType().FullName, $_.Exception.Message" -ForegroundColor Red } } } Listing 1: Load-Assembly A Typical PSSQLLIB function: Get-SQLServerPrivileges Most of the functions in PSSQLLIB use properties of the SMO server object. A few of the functions use T-SQL

Summary

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised 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.