Need job

Looking for job in Europe. Please contact thru LinkedIn profile.

Thursday, July 4, 2013

Powershell remote .NET assembly deploy to GAC

If you need to deploy something to remote iis server by coping assemblies, here is a script. 
In my case i have a hyper-v sharepoint 2013 for development. 
I can compile, deploy and debug remotely.

To copy files you can use another post from this blog.

$s = New-PSSession -computerName someserverHostname.ru
Invoke-Command -Session $s -Scriptblock {
    $gacUtil = "${Env:ProgramFiles(x86)}\NETFX 4.0 Tools\gacutil.exe";
    $filesOnServer = Get-ChildItem C:\folderNameOnServer  -Recurse | Where-Object {$_.name -like '*.dll'}  | Select-Object fullname
    $filesOnServer  | % {
        & $gacUtil '/nologo' '/if' $_.fullname;
        $_.fullname;
    }
    iisreset;
;}
Remove-PSSession $s

No comments:

Post a Comment