Monday

register dlls into GAC on server 2012

You may noticed that gacutil is missing in on server 2012.There is no clear way to download and install gacutil or have portable gacutil.exe to deploy. This powershell script will register multiple dlls from folder.
   
# adds all dll files from folders into GAC 
# **** Attention *** in case of permission/signature  error Execute this command from powershell to allow run powershell files : Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

# load System.EnterpriseServices assembly
[Reflection.Assembly]::LoadWithPartialName("System.EnterpriseServices") > $null

# create an instance of publish class
[System.EnterpriseServices.Internal.Publish] $publish = new-object System.EnterpriseServices.Internal.Publish


Get-ChildItem "C:\Program Files (x86)\Microsoft Enterprise Library 5.0\Bin" -Filter *.dll |
Foreach-Object {
    $content = $_.FullName
    Write-Output "registering "+$content;
    $publish.GacInstall($content)
}

Change path if you have to do batch install dlls from another directory.

No comments:

test smtp server with powershell

Send-MailMessage -SMTPServer smtp.domain.com -To [email protected] -From [email protected] -Subject "This is a test email" -Body ...