none
Strange Inconsistencies w/ Powershell Automation Scripts RRS feed

  • Question

  • Powershell...why must we have such a love-hate relationship?

    I'm currently in the process of programming a slew of automation scripts to make HTML based server statistical pages, network monitoring pages, and iLO board monitors easier to access. The concept is rather simplistic in nature, yet Powershell keeps shooting me down. At the moment I have a total of 5 .ps1 (Powershell) files and 5 .BAT files to activate said scripts. The .BAT files that configure and run the Powershell scripts work seamlessly. The Powershell scripts used to open\login to the Network Monitor and Server Statistics HTML pages work perfectly. The problem arises once I attempt to sign into the "iLO 4 Proliant" page. It claims that the usernameInput and passwordInput (both HTML elements) do not have a ".value" property. What confuses me is the fact that the other two iLO board automation scripts work fine. The reason that makes little to no sense is that the code is the EXACT same across the three iLO board scripts (excluding the username, password, and URL variable values). I've checked and rechecked my code to ensure that it isn't my own logical impairment but, sadly, it's just FRICKIN' Powershell. Here is the code I'm working with, sorry in advance for the sloppy comment statements. (Powershell scripting code first, .BAT file second): 

    -------------------------------------------------------------

    ILO#3.ps1

    #Desired username and password for the Network Monitor 
    $username = "abcd" 
    $password = "1234"      (Yes, I know it isn't safe to have the username and password in the source code. I'm working on an encryption program at the moment to make it more secure.)

    #Attaches web browser to the $ie variable as a "New-Object" 
    #".visible" attribute displays the web browser 
    #".navigate2" inserts the desired URL into the web broswer

    $ie = New-Object -com InternetExplorer.Application 
    $ie.navigate2("https://SomeILOPage") 
    $ie.visible=$true

    #Once the object has received all data and 100 milliseconds have passed the code below the while loop is executed 
    #The ".document" method is used to allow Powershell to receive HTML data from Internet Explorer
    #".getElementById" is used to identify HTML object by its ID 
    #".getElementById" is used to identify HTML object by its tagname
    #"modalFrame" is a separate HTML container. Since it separates certain content from other content, the code requires an extra reference to access and/or retrieve attributes within in.  
    #Once at the login screen the "usernameInput" and "passwordInput" HTML elements are identfied. After they have been identified the chosen username and password is inserted into their ".value" attributes  
    #"Select {$_.Click()}" is used to press the "Login" button. When the page is loaded Powershell identifies the button by Id and automatically activates it

    while($ie.ReadyState -ne 4) {start-sleep -m 100} 
    $ie.document.getElementById("overridelink") | Select {$_.Click()}
    $ie.document.getElementById("modalFrame").contentWindow.document.getElementById("usernameInput").value = "$username" 
    $ie.document.getElementById("modalFrame").contentWindow.document.getElementById("passwordInput").value = "$password" 
    $ie.document.getElementById("modalFrame").contentwindow.document.getElementById("ID_LOGON")| Select  {$_.Click()}

    #Closes Powershell (if open) 

    stop-process $pid

    ------------------------------------------------- 

    ILO#3.BAT File 

    #.BAT file outline used to call Powershell.exe with the desired .ps1 file already loaded 
    #This is also used to hide the Powershell screen from the user and to close the "cmd" screen after .ps1 file is executed 
    @ECHO OFF
    PowerShell.exe -NoProfile -Command "& {Start-Process PowerShell.exe -ArgumentList '-NoProfile -windowstyle hidden -ExecutionPolicy Bypass -File ""./ILO#3.ps1""' -Verb RunAs}"
    & {taskkill /im ".\cmd.exe"} 
    PAUSE

    -----------------------------------------------------

    As you can see: the scripts are simple, to the point, and should not have any errors. I also checked for multiple occurrences of the .ps1 file thinking maybe that could be causing an error, I found nothing. Any help would be greatly appreciated! Please reply to this post or email me at Jacobalexandercaffee@gmail.com (email is preferred). Quicker the response, the better. I'm supposed to have this finished and ready to show to my boss by the end of my shift today. 

    Et tu, Powershell? 

    Thursday, July 28, 2016 1:37 PM

Answers

  • HP ILO web pages need to be updated to match current version of the "homepage" software.  Older pages were open .  Newer versions may use different scripting methods to protect pages or to implement a more dynamic page.


    \_(ツ)_/

    Thursday, July 28, 2016 3:36 PM

All replies

  • Hi,

    welcome to the Technet Forums :)

    Some ideosyncracies will always haunt us, I'm afraid. I can't tell you the cause of your problem, assuming PowerShell is at fault - I don't really use IE in PowerShell, though it certainly has its use in this scenario. Maybe the websites are not identical and some of the elements have different IDs.

    Regarding your Password issue though ... you can use this script to protect credentials a bit better with little effort.

    Cheers,
    Fred


    There's no place like 127.0.0.1

    Thursday, July 28, 2016 1:48 PM
  • Thanks for the credential encryption script and the warm welcome! I wasn't even aware "Get-Credential" was thing.  

    I've been coding with Powershell for a couple of months now and it amazes me that such a rudimentary script is causing me this much grief. I wish the problem was as simple as an incorrect element but alas, it is not. It occasionally works and it occasionally doesn't work at all, sometimes it does everything out of whack. Whenever I run it now it only puts in my password and hits login, early it was hitting the Login key before the the username and password fields were filled. Powershell is a confusing beast. 


     
    Thursday, July 28, 2016 2:09 PM
  • Why are you using the Bat files at all? It would cut out a step to keep it all as PS1 files.
    Thursday, July 28, 2016 2:18 PM
  • For an easier launch process and to hide source code. The batch files allow me to launch the .ps1 files without having to even open Powershell and start a debugging process. The way I have it set-up makes it so once the script is activated the batch file closes Powershell. I also have the stop-process $pid to ensure that Powershell.exe closes when the script is run. It also gives me a simplistic way to use hyperlinks on the Server Rack visual in Visio to directly link to the .BAT file without confusing anyone else. It's mainly for outside personnel that might come in to work on server side issues, that way they have an incredibly easy method to view server statistics and whatnot. The batch files are not causing the problem and whenever I launch it from the .BAT file it tends to work more often than in the debug. If you have another suggestion I'm open to it. All I know is that Visio is unable to link and then open a .ps1 file. Plus the .BAT file template only changes slightly whenever I need to load a different .ps1 file so it isn't a hassle. 
    Thursday, July 28, 2016 2:40 PM
  • The launch process is easier, bat files can be double clicked whilst a PS1 needs to be right clicked and then select 'run with PowerShell'.

    Hiding source code isn't something I like the idea of. It's security through obscurity and, ironically, by using a batch file it makes it easier to subvert as you can at least use Signing with PowerShell.

    It's hard to say that bat files aren't relevant as it adds another layer of potential failure.

    Generally it's a pattern I dislike, which does not mean that it's wrong in this case.

    On a more useful track, when you say 'debug' session do you mean using ISE? If so then I'd avoid doing that to test as it does behave differently from the normal PS environment.

    Thursday, July 28, 2016 3:31 PM
  • HP ILO web pages need to be updated to match current version of the "homepage" software.  Older pages were open .  Newer versions may use different scripting methods to protect pages or to implement a more dynamic page.


    \_(ツ)_/

    Thursday, July 28, 2016 3:36 PM
  • You're 100% correct! I went to inspect the source code and found that the HTML code for that specific iLO has a new script. Which means that the other pages will (most likely) be getting the same exact script update...back to the drawing board. Time to freshen up on my HTML. 



    Thursday, July 28, 2016 4:37 PM
  • If anyone knows how to read Javascript really well I would greatly appreciate some help. I'm trying to figure out which lines of code are not allowing me to retrieve and/or send variable/elements. I don't know Javascript all that well so any help would be appreciated! 

    <!-- RpPageHeader RpUrl=/html/login_box.html RpAccess=Realm2 RpAccess=Realm3 RpObjectType=Static -->
    <!DOCTYPE HTML>
    <html>
    <head>
    <title>Login</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="copyright" content="Copyright © 2006-2011 Hewlett-Packard Development Company, L.P." />

    </head>
    <body id="loginBoxContent" style="display:none;">
    <script type="text/javascript">
    var refresh=false;
    var retryCount=0;
    var me=this;
    var ver;
    var t_out;
    var certPromp=true;
    var dir_allowed=false;

    if(typeof (isConnected)=="undefined") {
    var isConnected=iLO.init({});
    }

    if(iLOGlobal.login_delay) {
    setTimeout(function () {
    me.preSignIn();
    iLOGlobal.logout_message=null;
    iLOGlobal.login_delay=0;
    },iLOGlobal.login_delay*1000);
    } else {
    me.preSignIn();
    iLOGlobal.logout_message=null;
    }

    function updatePage() {
    certPromp = true;
    var msg="";
    if(jQuery.isPlainObject(iLOGlobal.logout_message)) {
    /*<!-- RpDZT parse=0 TrimLeading TrimTrailing -->*/
    msg="<span rel=\"localize[login.logout]\">"+iLO.translateString("login.logout","<strong>Logged Out: <strong/>")+"</span>"+
    "<span rel=\"localize["+iLOGlobal.logout_message.langKey+"]\">"+iLO.translateString(iLOGlobal.logout_message.langKey,iLOGlobal.logout_message.text)+"</span><br />";
    /*<!-- RpEnd -->*/
    }
    if(jQuery.isNonZeroInteger(iLOGlobal.login_delay)) {
       /*<!-- RpDZT parse=0 TrimLeading TrimTrailing -->*/
       if (iLOGlobal.login_delay < 60) {
           msg += "<span rel=\"localize[login.plsWait]\">" + iLO.translateString("login.plsWait", "Please wait ") + "</span>" + iLOGlobal.login_delay +
       "<span rel=\"localize[login.seconds]\">" + iLO.translateString("login.seconds", " seconds") + ".\n</span>";
       }
       else {
           msg += "<span rel=\"localize[login.severalMins]\">" + iLO.translateString("login.severalMins", "This operation may take several minutes") + ".\n</span>";
       }
    /*<!-- RpEnd -->*/
    me.toggleEnabled(false);
    }
    var time_delay=(jQuery.existsNonNull(iLOGlobal.login_delay))?iLOGlobal.login_delay*1000:0;
    if($("#ID_LOGOUT_REASON").is(":hidden")) {
    if(msg!="") {
    $('#ID_LOGOUT_REASON').displayInformative({ message: msg }).doTimeout(time_delay,function() { if(time_delay>0) { doClearAll(); } preSignIn(); });
    } else {
    preSignIn();
    }
    }
    }

    function refreshPage() {
    iLO.setCookie("sessionKey",null);
    iLOGlobal.cache["session_key"]=null;
    try {
    iLOGlobal.topPage.location.reload();
    } catch(e) {
    location.reload();
    }
    }

    function changeLanguage() {
    var lang=$("#lang_options option:selected").val();
    iLO.setLanguage(lang);
    iLO.translatePage();
    }

    function preSignIn() {
    if(certPromp){
    me.toggleEnabled(false);
    t_out = setTimeout(function(){
    $('#ID_LOGIN_FAILED_CUSTOM').text("").displayError({langKey:"login.netChanged", text:"Connection with iLO cannot be established. If you recently made changes to the network configurations, you may need to refresh this page to re-negotiate an SSL connection."});
    },10000);
    certPromp = false;
    iLO.sendJsonRequest("login_session","GET","/json/login_session",null,function (o,fname,error) {
    $(document).ready(function () {
    preSignInCallback(o,fname,error);
    });
    });
    }
    }

    function rnd() { return String((new Date()).getTime()).replace(/\D/gi,''); }

    function preSignInCallback(o,fname,error) {

    clearTimeout(t_out);
    var msg=iLO.checkError(o,fname,error);

    if(msg||(jQuery.isPlainObject(o)&&o.secjmp==null)) {
    certPromp = true;
    //TODO: hook this up to a polling mechanism and 
    //display error message if trying to connect for a certain amount of time
    refresh=true;
    iLO.setCookie("sessionKey",null);
    iLOGlobal.cache["session_key"]=null;
    if(retryCount>=10) { //give up since we have tried to reconnect too many times
    $('#ID_LOGIN_FAILED_CUSTOM').displayError({ langKey: "login.brwsrUnableCommiLo",text: "The browser is unable to communicate with iLO.",message: " ." });
    }
    jQuery.log('Re-Making preSignIn call from line 104. Re-try count: '+retryCount);
    setTimeout("preSignIn();",2000);
    retryCount++;
    return true;
    }
    if(refresh) {
    refreshPage();
    return true;
    }
    //clear error messages
    //me.doClearAll();

    me.toggleEnabled(true);

    //security warning message

    if (o.security_message_enabled && jQuery.isValidString(o.security_message)) {
    var ver = iLO.getIEVersion();
    var $securityMessage = $("#securityMessage");
    $securityMessage.text("");

    if (ver > 0 && ver <= 7) {
    /*<!-- RpDZT parse=0 TrimLeading TrimTrailing -->*/
    var secmsg = o.security_message.replace(/(\n\r|\r\n|\n)/g,"<br />").split("<br />");
    for (var i=0; i < secmsg.length; i++) {
    $securityMessage.append($('<span></span>').text(secmsg[i])).append("<br />");
    }
    /*<!-- RpEnd -->*/
    $securityMessage.parents("#loginSecurityBanner").show();
    } else {
    $("#securityMessage").text(o.security_message).parents("#loginSecurityBanner").show();
    }
    } else {
    $("#securityMessage").text("").parents("#loginSecurityBanner").hide();
    }

    if(jQuery.isValidString(o.default_lang)) {
    iLOGlobal.default_language=o.default_lang;
    }

    var ver_text=o.version;
    if(jQuery.isValidString(o.ilo_fw_pass)) ver_text+="  "+o.ilo_fw_pass;
    $("#fwver").text(ver_text);
    $("#fwver_span").show();
    if(o.cn) {
    /*<!-- RpDZT parse=0 TrimLeading TrimTrailing -->*/
    $("#cn").html('<a title="Host Common Name (CN)" style="color:white;font-size: 13pt;" target="_new" href="https://'+o.cn+'"/ >'+o.cn+'</a>');
    /*<!-- RpEnd -->*/
    if(o.server_name && jQuery.existsNonNull(iLOGlobal.topPage)) {//update title
    var title=iLOGlobal.topPage.jQuery(iLOGlobal.topPage.document).attr("title").replace(/:.*/,"")+": "+((o.server_name)?o.server_name:"")+" - "+o.cn;
    if(o.blade) {
    title+="" + ((o.bay_num) ? " - " + o.bay_num:"") + ((o.enc_name) ? " - " + o.enc_name: "") + ((o.rack_name) ? " - " + o.rack_name:"");
    }
    try { iLOGlobal.topPage.document.title=title; } catch(e) { }
    iLOGlobal.topPage.jQuery(iLOGlobal.topPage.document).attr("title",title);
    }
    }
    if(o.secjmp==null||typeof (o.secjmp)=="undefined") {
    $('#ID_LOGIN_FAILED_CUSTOM').displayError({ langKey: "login.brwsrUnableCommiLo",text: "The browser is unable to communicate with iLO.",message:".." });
    } else if(o.secjmp) {
    /*<!-- RpDZT parse=0 TrimLeading TrimTrailing -->*/
    $('#ID_SECJMP').displayError({ langKey: "login.secSwOn",text: "<strong>Alert! </strong>iLO security override switch is set. Security enforcement is disabled." });
    /*<!-- RpEnd -->*/
    }

    me.dir_allowed=o.license_directory_auth&&(o.ldap_enabled!=0||o.kerberos_enabled);

    if(me.dir_allowed&&o.kerberos_enabled) {
    $('#ID_SPNEGO_FRAME').show();
    } else{
    $('#ID_SPNEGO_FRAME').hide();
    }

    if(o.local_enabled&&me.dir_allowed) {
    $('#usernameBox').html('Directory&nbsp;or&nbsp;local&nbsp;user&nbsp;name:').attr("rel","localize[login.DirectoryOrUserName]");
    } else if(!o.local_enabled&&me.dir_allowed) {
    $('#usernameBox').html('Directory&nbsp;user&nbsp;name:').attr("rel","localize[login.DirectoryUserName]");
    } else {
    $('#usernameBox').html('Local&nbsp;user&nbsp;name:').attr("rel","localize[login.LocalUserName]");
    }

    if(o.login_delay) {
    me.toggleEnabled(false);
    /*jsl:ignore*/
    $('#ID_LOGIN_DELAY').displayInformative({ langKey: "login.loginDelay",text: "Login Delayed for ",message: o.login_delay+'<span rel="localize[login.seconds]">'+iLO.translateString("login.seconds"," seconds")+'.\n</span>' })
    .doTimeout(o.login_delay*1000,function () { me.toggleEnabled(true);me.doClearAll(); });
    /*jsl:end*/
    } else {
    me.toggleEnabled(true);
    }

    //language
    iLO.setSupportedLanguages(o.langs);
    if(jQuery.isArray(o.langs)) {
    if(o.langs.length>1) {
    $("#lang_row").show();
    var lang=iLO.getLanguage();
    $lang_options=$("#lang_options");
    $lang_options.html($("#lang_option_template").jqote(o.langs));
    if(!lang) {
    lang = iLO.isSupportedLanguage(iLOGlobal.default_language)?iLOGlobal.default_language:"en";
    iLO.setLanguage(lang);
    }
    $("#lang_options option[value=\""+lang+"\"]").attr("selected","true");
    } else { //If current language is uninstalled, set back to en and translate login page
    iLO.setLanguage("en");
    iLO.translatePage();
    $("#lang_row").hide();
    }
    }

    if(msg||o.secjmp==null) {
    var sURL=unescape(window.location.pathname);
    setTimeout("window.location.href = \""+sURL+"\"",20*1000);
    $("#loginBoxContent").show();
    return false;
    }

    //ipmanager
    if(jQuery.existsNonNull(o.ipmanager)&&(jQuery.existsNonNull(o.ipmanager.managerProductName)||jQuery.existsNonNull(o.ipmanager.ManagerProductName))) {
    if(jQuery.existsNonNull(o.ipmanager.managerProductName)) { o.ipmanager.ManagerProductName=o.ipmanager.managerProductName;
    o.ipmanager.ManagerUrl= { "xref": o.ipmanager.managerUrl };
    }
    //escape strings here
    o.ipmanager.ManagerUrl.xref=jQuery('<div/>').text(o.ipmanager.ManagerUrl.xref).html();
    o.ipmanager.ManagerProductName=jQuery('<div/>').text(o.ipmanager.ManagerProductName).html();
    iLOGlobal.ipmanager=o.ipmanager;
    var msg="<span>"+iLO.translateString("login.ipmanager_managed","<strong>Warning!&nbsp;</strong>Some iLO settings are managed by:")+
    "</span>&nbsp;"+'<a title="'+o.ipmanager.ManagerUrl["xref"]+'" target="_new" href="'+o.ipmanager.ManagerUrl["xref"]+'"/ >'+o.ipmanager.ManagerProductName+
    "</a>.<br/><br/><span rel=\"localize[login.ipmanager_managed2]\">"+
    iLO.translateString("login.ipmanager_managed2","Changes made directly in iLO will be out of sync with the centralized settings.")+"\n</span>";
    $("#ID_IPMANAGER").displayWarning(msg);
    } else $("#ID_IPMANAGER").hide();

    if(o.version) {
    me.ver=o.version+o.ilo_fw_pass;
    var prev_ver=iLOGlobal.cache["version"];
    if(jQuery.isValidString(prev_ver)&&(ver!=prev_ver)) {
    iLOGlobal.cache={};
    iLO.setCookie("sessionKey",null);
    //TODO: EOV modal alert "OK"
    alert(iLO.translateString("login.fwverUpdateAlrt","The iLO firmware version has been changed.  Please clear the browser cache before continuing."));
    setTimeout(function () {
    try {
    iLOGlobal.topPage.location.href=iLOGlobal.topPage.location.href.replace(/\?.*/,"")+"?="+me.rnd();
    } catch(e) { }
    },20);
    $("#loginBoxContent").show();
    return false;
    }
    }
    iLO.translatePage();
    $("#loginBoxContent").show();
    return false;
    }

    function toggleEnabled(bEnabled) {
    $("#ID_LOGON").toggleEnabled(bEnabled);
    $("#ID_SPNEGO").toggleEnabled(bEnabled);
    $("#usernameInput").toggleEnabled(bEnabled);
    $("#passwordInput").toggleEnabled(bEnabled);
    if(bEnabled) {
    $("#ID_LOGIN_DELAY, #ID_LOGIN_FAILED_CUSTOM").hideMessage().html("");
    $("#usernameInput").focus();
    }
    }

    function checkEnter(e) {
    var characterCode;

    try {
    if(e&&e.which) {
    /* Mozilla */
    characterCode=e.which;
    } else {
    /* Internet Explorer */
    characterCode=e.keyCode;
    }
    if(characterCode==13) {
    signIn();
    return false;
    } else {
    return true;
    }
    } catch(err) {
    /* allow the keypress on error. */
    return true;
    }
    }

    function signIn() {
    certPromp = true;
    $('#ID_LOGIN_FAILED_CUSTOM').hideMessage();
    $('#ID_LOGOUT_REASON').hideMessage();
    me.toggleEnabled(false);
    iLO.clearSessionKey();
    var jsonObj={
    "method": "login",
    "user_login": $("#usernameInput").val(),
    "password": $("#passwordInput").val()
    };
    var timeout=120000;
    if(me.dir_allowed) timeout=1200000;
    iLO.sendJsonRequest("login","POST","json/login_session",jsonObj,me.signInCallback,null,timeout); // 2m timeout
    return false;
    }

    function signInCallback(o,fname,error) {
    var msg=iLO.checkError(o,fname,error);
    if(msg) {
    if(jQuery.isPlainObject(o)) {
    if(error==iLOGlobal.constants.HttpErrors.Forbidden) {
    if(o.message=='JS_ERR_NO_PRIV') {
    $('#ID_LOGIN_FAILED_CUSTOM').displayError({ langKey: "login.failLogin1",text: "Failed login attempt, Unauthorized." });
    me.toggleEnabled(false);
    setTimeout("preSignIn();",1000);
    } else if(o.message=='JS_ERR_FAILURE') {
    $('#ID_LOGIN_FAILED_CUSTOM').addError({ langKey: "login.failLogin3a",text: "Account Login Unavailable\n" });
    $('#ID_LOGIN_FAILED_CUSTOM').addError({ langKey: "login.failLogin3b",text: "Due to the number of users currently logged in, access to the iLO processor is unavailable at this time.\n" });
    $('#ID_LOGIN_FAILED_CUSTOM').addError({ langKey: "login.failLogin3c",text: "Please try again later. " });
    }
    } else if(error==iLOGlobal.constants.HttpErrors.InternalError) {
    if(o.message=='JS_ERR_FAILURE') {
    $('#ID_LOGIN_FAILED_CUSTOM').displayError({ langKey: "login.failLogin2",text: "Failed login attempt, Login Delay required." });
    me.toggleEnabled(false);
    setTimeout("preSignIn();",1000);
    } else {
    //other errors
    var details=(jQuery.existsNonNull(o.details))?o.details:"";
    $('#ID_LOGIN_FAILED_CUSTOM').displayError({ langKey: "login.failLoginErr",text: "Login Error: ",message: "error="+error+", message="+o.message+", details="+o.details });
    }
    }
    } else { $('#ID_LOGIN_FAILED_CUSTOM').displayError({ langKey: "login.failLoginErr",text: "Login Error: ",message: msg }); }
    return;
    }

    var sessionKey=o.session_key;
    if(sessionKey) {
    jQuery.cookies.set('sessionKey',sessionKey);
    iLOGlobal.cache={};
    iLOGlobal.cache["session_key"]=sessionKey;
    iLOGlobal.cache["login_session"]=o;
    iLOGlobal.cache["version"]=me.ver;
    me.doClearAll();
    me.toggleEnabled(false);

    if(iLOGlobal.isApplication)
    try { iLOGlobal.topPage.showApplication(); } catch(e) { }
    if(jQuery.isFunction($('#login_dialog').dialog))
    $('#login_dialog').dialog("close");
    } else {
    //TODO: handle case where a session key is not returned
    /*jsl:pass*/
    //me.failLogin();
    }
    }

    function failLogin(errorMsg) {
    me.toggleEnabled(true);
    $("passwordInput").focus();
    $("passwordInput").val('');
    }

    function doClearAll() {
    try {
    $("#passwordInput").val("");
    $("#usernameInput").val("").focus();
    $("#messageSection div").hideMessage().html("");
    } catch(e) { }
    }

    //TODO: add 2 spenego functions
    function spnegoCallback(data,textStatus,xhr) {
    //TODO: get and set the Session Key!

    // top.setCookieValue("sessionKey", callObj.serverCookie);

    //TODO: should NOT be using top.anything
    if(iLOGlobal.isApplication)
    top.showApplication();
    $('#login_dialog').dialog("close");
    }

    function spnegoError(xhr,textStatus,error) {
    me.toggleEnabled(true);
    $("#ID_SPNEGO").toggleEnabled(false);
    /*<!-- RpDZT parse=0 TrimLeading TrimTrailing -->*/
    var msg=iLO.translateString("login.zeroSignIn","HP Zero Sign In")+iLO.translateString("login.authFailed",": Login Authorization failed<br />");
    /*<!-- RpEnd -->*/
    $('#ID_LOGIN_FAILED_CUSTOM').displayError({ langKey: "",text: msg });
    }

    function signInSpnego() {
    $('#ID_LOGIN_FAILED_CUSTOM').hideMessage();
    me.toggleEnabled(false);
    $.ajax({
    cache: false,
    url: "login_spnego.html",
    dataType: 'html',
    success: spnegoCallback,
    error: spnegoError,
    global: false,
    timeout: 5000,
    type: "GET"
    });
    return false;
    }

    function languageChangeHandler() {
    var lang = iLO.getLanguage();
    $("#lang_options option").removeAttr("selected");
    $("#lang_options option[value="+lang+"]").attr("selected","true");
    iLO.translatePage();
    }

    function unloadfunc() {
    certPromp = true;
    }
    window.onbeforeunload=function () { return me.unloadfunc(); };
    $(document).unload(function () {
    // stop polling for events
    me.unloadfunc();
    //only need to run once
    $(document).unbind('unload');
    });

    $.subscribe("/language/change",me.languageChangeHandler);

    </script>
    <table class="full_H " border="0" cellspacing="0" cellpadding="0" style="width:60%;">
    <tr>
    <td colspan="2" height="30px"></td>
    </tr>
    <tr>
    <td colspan="2">
    <div id='ID_SECJMP' style="display: none;"></div>
    <div id='ID_IPMANAGER' style="display: none;"></div>
    </td>
    </tr>
    <tr>
    <td class="login_fields_lable" style="width: 34%;">
    <span id="usernameBox" style="white-space: nowrap; vertical-align: middle;"
    rel="localize[login.loginName]">
    Login Name:</span>
    </td>
    <td class="login_fields">
    <!-- RpDZT parse=0 TrimLeading TrimTrailing -->
    <input autocomplete="off" class="textfield" type="text" name="usernameInput" id="usernameInput"
    size="30" onkeypress="return checkEnter(event);" />
    <!-- RpEnd -->
    </td>
    </tr>
    <tr>
    <td class="login_fields_lable" style="width: 34%;">
    <span id="passwordBox" style="vertical-align: middle;" rel="localize[login.password]">
    Password:</span>
    </td>
    <td class="login_fields">
    <!-- RpDZT parse=0 TrimLeading TrimTrailing -->
    <input autocomplete="off" class="textfield" type="password" name="passwordInput"
    id="passwordInput" size="30" onkeypress="return checkEnter(event);" />
    <!-- RpEnd -->
    </td>
    </tr>
    <tr id="lang_row" style="display:none;" >
    <td class="login_fields_lable" style="width: 34%;">
    <span id="languageBox" style="vertical-align: middle;" rel="localize[navigation.lang]">
    Language:</span>
    </td>
    <td class="login_fields">
    <!-- RpDZT parse=0 TrimLeading TrimTrailing -->
    <select name="lang_options" id="lang_options" onchange="changeLanguage();">
    <option value="en">English</option>
    </select>
    <!-- RpEnd -->
    </td>
    </tr>
    <tr id="remember_section" style="display:none;">
    <td style="text-align:right;">
    <br />
    <span class="remember_cb" >
    <!-- RpDZT parse=0 TrimLeading TrimTrailing -->
    <input type="checkbox" id="remember_checkbox" name="remember_checkbox" value="checkboxValue" />
    <!-- RpEnd -->
    </span></td>
    <td>
    <br />
    <span id="rememberBox" rel="localize[login.remember]" style="white-space: nowrap;">Remember
    my login information on this browser.&nbsp;&nbsp;<br />
    </span>
    </td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td>
    <br />
    <button id="ID_LOGON" name="ID_LOGON" type="button" onclick="signIn(); return false;" rel="localize[login.loginButton]">Log In</button>
    <!--<button id="lang_button" onclick="javascript:showLang()" style="display:none;width: 25px; max-width: 25px; min-width: 25px;">EN</button>-->
    </td>
    </tr>
    <tr><td></td><td id='ID_SPNEGO_FRAME' style="display: none">
    <button tabindex="5" id="ID_SPNEGO" name="ID_SPNEGO" onclick="javascript:signInSpnego();return false;"
    rel="localize[login.zeroSignIn]">HP Zero Sign In</button>
    </td></tr>
    <tr><td colspan="2" id="messageSection">
    <!-- Highlight / Error -->
    <div id="ID_LOGIN_FAILED_CUSTOM" style="display: none;"></div>
    <div id="ID_LOGIN_DELAY" style="display: none;"></div>
    <div id="VALIDATION_ERROR" style="display: none;"></div>
    <div id="ID_LOGOUT_REASON" style="display: none;"></div>
    </td></tr>
    </table>

    <script type="text/x-jqote-template" id="lang_option_template">
    <!-- RpDZT parse=0 TrimLeading TrimTrailing -->

    /*!<![CDATA[
    <option value="<%= this.lang %>"><%= this.trans_name %></option>
    ]]>!*/

    <!-- RpEnd -->
    </script>


    </body>
    </html>

    Thursday, July 28, 2016 6:18 PM
  • From what I see the page has been designed to prevent you from logging in the way you are trying to log in.  You will have to contact HP and acquire the ILO SDK and use normal means of extracting this data.  Post in HP management forum for help


    \_(ツ)_/

    Thursday, July 28, 2016 6:54 PM
  • From what I see the page has been designed to prevent you from logging in the way you are trying to log in.  You will have to contact HP and acquire the ILO SDK and use normal means of extracting this data.  Post in HP management forum for help


    \_(ツ)_/

    Actually, there is an entire Ilo PowerShell Module available from HP.

    Not the best module I've ever laid my hands on, but serviceable (mind you, it's been more than a year, might be the current one has improved).


    There's no place like 127.0.0.1

    Thursday, July 28, 2016 7:56 PM