Windows server and Oracle Java updates

Domingues, Michael D michael-domingues at uiowa.edu
Fri Dec 2 17:05:52 EST 2016


It's baked right in to CMD.exe, and they've provided no PowerShell alternative, so if you're pushing at the PowerShell layer, you could use something like this. Yes, the /S /Q syntax on the second function looks odd, but it achieves the desired behavior of only taking out the link.


function New-Symlink
{
    [CmdletBinding()]
    param([string]$Link, [string]$Target);
    Start-Process-Custom -FilePath "cmd.exe" -ArgumentList "/C mklink /D `"$Link`" `"$Target`"";
}

function Remove-Symlink
{
    [CmdletBinding()]
    param([string]$Link);
    Start-Process-Custom -FilePath "cmd.exe" -ArgumentList "/C rmdir /S /Q `"$Link`"";
}


Also relevant for those trying to automate (or at least script) their Oracle Java installs on Windows is a way to programatically check the Oracle License Agreement:


function Get-OracleDownload
{
    param([URI]$URI, [string]$OutFile);

    $session = New-Object Microsoft.PowerShell.Commands.WebRequestSession;

    $oracle_cookie = New-Object System.Net.Cookie ;

    $oracle_cookie.Name = "oraclelicense";
    $oracle_cookie.Value = "accept-securebackup-cookie";
    $oracle_cookie.Domain = ".oracle.com";

    $session.Cookies.Add($oracle_cookie);

    Invoke-WebRequest -Uri $URI -WebSession $session -TimeoutSec 900 -OutFile $OutFile -ErrorAction Stop;

    return $OutFile;
}


Michael

________________________________
From: users <users-bounces at shibboleth.net> on behalf of Cantor, Scott <cantor.2 at osu.edu>
Sent: Friday, December 2, 2016 3:59:58 PM
To: Shib Users
Subject: Re: Windows server and Oracle Java updates

On 12/2/16, 4:57 PM, "users on behalf of Dave Bartholomew" <users-bounces at shibboleth.net on behalf of Dave.Bartholomew at csueastbay.edu> wrote:

>> to expect people to maintain a symlinked folder to the "latest" jre/jdk
>>    and use that explicitly.
>    Yes, I would do that too - if I were still running on Linux...

Windows supports symlinks too.

-- Scott


--
To unsubscribe from this list send an email to users-unsubscribe at shibboleth.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/users/attachments/20161202/ade4ec40/attachment-0001.html>


More information about the users mailing list