Getting Error when trying to deploy image using K2000 version 3.5.80613
Started getting failure message when trying to deploy image via K2000. 'An error has occurred on the script on this page' The strangest part of the error window is URL: file:///Y/hta/imaging_deploy.html' Can anyone help me get this fixed?
-
This error occurs on all our images now. Not sure what changed. - svriecss 10 years ago
Answers (2)
I have noticed the same scripting for whenever I'm trying to capture an image before I deploy a fresh image. This has been the only time that I would see this type of scripting on the K2000 that I manage. The one solid solution that has worked for me was to do a WET first, (if your not comfortable with backing up the files in the K2000). Next, install a fresh image from your newly scripted image that you have created on the K2000. After completing your new OS standard install, do another instance of WET after logging in as the user so that none of the users work/data will be lost. Let me know if that works for you.
Comments:
-
What's a WET? - mleblanc 8 years ago
That is the file that gives you the deploy image screen you see. so some script that page contains is not running correctly. Does this do this for all images or just one?
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="deployment_client.css" />
<script language="JavaScript" src="kacelib.js"></script>
<script language="JavaScript" src="prototype.js"></script>
<script language="VBScript" src="kacelib.vbs"></script>
<script language="JavaScript">
function RPCListSystemImagesJsonHandleAjaxError(response) {
var opt = document.createElement('OPTION');
opt.text = 'Error contacting server';
$('image_id').add(opt);
$('deploy_drives').disabled = true;
}
function RPCListSystemImagesJsonProcessData(response) {
var images = eval('(' + response.responseText + ')');
for(var i = 0, image = images[0]; i < images.length; image = images[++i]) {
if(VBFileExists(image.script)) {
var opt = document.createElement('OPTION');
opt.text = image.name + ' [' + 'Modified: ' + image.modified + ']';
opt.value = image.id + '-' + image.script + '-' + image.user_state + '-' + image.offline_scan;
$('image_id').add(opt);
}
}
if($('image_id').options.length == 0) {
var opt = document.createElement('OPTION');
opt.text = 'No suitable images found.';
$('image_id').add(opt);
$('deploy_drives').disabled = true;
}
// unique work directory for offline scan
work_dir = JSGetUniqueName();
ShowUserStatesOffline();
RPCListUsmtVersionJson();
}
function RPCListSystemImagesJson() {
var server_name = VBGetServerName();
var rpc_url = 'http://' + server_name + '/rpc/list_system_images_json';
var rpc_params = $H({
mac: VBGetMAC(),
type: 'K-image',
architecture: GetArchDirectory()
});
var qstring = rpc_params.toQueryString();
var request = new Ajax.Request(rpc_url, {
method: 'get', parameters: qstring,
onSuccess: RPCListSystemImagesJsonProcessData,
onFailure: RPCListSystemImagesJsonHandleAjaxError
});
}
function DeployDrives(locale) {
var image_id = tmp[0];
var script = tmp[1];
var collection = document.getElementById('user_states').getElementsByTagName('INPUT');
if(collection.length > 0) {
var ids = new Array();
for(var x=0, j=0; x<collection.length; x++) {
if ((collection[x].type.toUpperCase()=='CHECKBOX') && (collection[x].checked == true)){
ids[j++] = collection[x].value;
}
}
if(ids.length) {
var script = script + ' ' + '\"USERSTATE=' + ids.join(',') + '\"';
}
}
// Save the user selection in temporary files
var to_be_scan_list = new Array();
var to_be_scan_list = JSGetSelected('to_be_scan');
if(to_be_scan_list.length > 0) {
// Create the top level work directory
VBCreateFolder("T:/" + work_dir);
VBWriteFile("T:/" + work_dir + "/to_be_scan_list", to_be_scan_list.join(','));
var to_be_deploy_list = new Array();
var to_be_deploy_list = JSGetSelected('to_be_deploy');
if(to_be_deploy_list.length > 0) {
VBWriteFile("T:/" + work_dir + "/to_be_deploy_list", to_be_deploy_list.join(','));
}
script = script + " \"OFFLINE_METHOD=ATTEND\"";
script = script + " \"OFFLINE_DIR=" + work_dir + "\"";
script = script + " \"OFFLINE_TEMPLATE=" + usmt_template_id + "\"";
}
script = script + " \"LOCALE=" + locale + "\"";
var retJS = JSRunCommand(script, 1, true);
if (retJS == 0) {
if($('opt_restart').checked) {
VBRestartMachine();
} else {
VBMsgBox('Image successfully deployed.');
}
} else if (retJS == 6) {
// deployment interrupted by user
VBMsgBox('Image deploy aborted. Image was not deployed successfully.');
} else {
// image not deployed because of other error
var errMsg = 'Image deployment failed. See log for details.';
VBMsgBox(errMsg);
}
Element.show('logdiv');
var log = VBReadFileToString('T:\\W_' + VBGetMac() + '_' + image_id + '.log', -1, 250);
$('log').appendChild(document.createTextNode(log.replace(/\x0a/g, '')));
$('log').scrollTop = $('log').scrollHeight + $('log').clientHeight;
}
function RPCListUserStatesJsonHandleAjaxError(response) {
$('user_state_error').innerHTML = 'Error contacting server';
Element.show('user_state_error');
}
function RPCListUserStatesJsonProcessData(response) {
var user_states = eval('(' + response.responseText + ')');
if($('user_states').hasChildNodes()) {
while ($('user_states').childNodes[0]) {
$('user_states').removeChild($('user_states').childNodes[0]);
}
}
var tbody = document.getElementById('user_states');
for(var i = 0, user_state = user_states[0]; i < user_states.length; user_state = user_states[++i]) {
var usfile = 'Y:\\user_states\\' + user_state.id;
if(VBDirExists(usfile)) {
var tmpRow = tbody.insertRow();
var tmpCol = tmpRow.insertCell();
var chkBox = document.createElement('input');
chkBox.type = 'checkbox';
chkBox.name = 'selected_profiles';
chkBox.value = user_state.id;
tmpCol.appendChild(chkBox);
tmpCol = tmpRow.insertCell();
tmpCol.innerText = user_state.profile;
tmpCol = tmpRow.insertCell();
tmpCol.innerText = user_state.host;
tmpCol = tmpRow.insertCell();
tmpCol.innerText = user_state.created;
tmpCol = tmpRow.insertCell();
tmpCol.innerText = user_state.domain;
tmpCol = tmpRow.insertCell();
tmpCol.innerText = user_state.os;
tmpCol = tmpRow.insertCell();
tmpCol.innerText = user_state.arch;
tmpCol = tmpRow.insertCell();
tmpCol.innerText = user_state.usmt;
tmpCol = tmpRow.insertCell();
tmpCol.innerText = user_state.size;
tmpCol = tmpRow.insertCell();
tmpCol.innerText = user_state.template;
}
}
var userStatesPresent = document.getElementById('user_states').getElementsByTagName('INPUT');
if(userStatesPresent.length == 0) {
if(VBFileExists('Y:\\hta\\disable_capture.txt')) {
$('user_state_error').innerHTML = 'Currently, either there are no user states scanned and uploaded to the server or have not been synced to the remote site appliance.';
} else {
$('user_state_error').innerHTML = 'Currently, there are no user states scanned and uploaded to the server.';
}
Element.show('user_state_error');
} else {
$('user_state_error').innerHTML = '';
Element.hide('user_state_error');
}
}
function RPCListUsmtVersionJsonHandleAjaxError(response) {
$('usmt_version').innerHTML = 'Error contacting server';
}
function RPCListUsmtVersionJsonProcessData(response) {
var usmt_versions = eval('(' + response.responseText + ')');
for(key in usmt_versions) {
var opt = document.createElement('OPTION');
opt.text = usmt_versions[key];
opt.value = key;
$('usmt_version').add(opt);
}
}
function RPCListUsmtVersionJson() {
var server_name = VBGetServerName();
var rpc_url = 'http://' + server_name + '/rpc/list_usmt_version_json';
var requestUsmtVersion = new Ajax.Request(rpc_url, {
method: 'get',
onSuccess: RPCListUsmtVersionJsonProcessData,
onFailure: RPCListUsmtVersionJsonHandleAjaxError
});
}
function ShowUserStates() {
tmp = $F('image_id').split(/-/, 4);
var image_id = tmp[0];
var script = tmp[1];
var user_state = tmp[2];
if(user_state == 'true') {
var server_name = VBGetServerName();
var rpc_url = 'http://' + server_name + '/rpc/list_user_states_json';
if(document.getElementById('usmt_version')) {
var usmt_tool_selected = $F('usmt_version');
var rpc_params = $H({usmt_version: usmt_tool_selected,
architecture: GetArchDirectory()
});
qstring = rpc_params.toQueryString();
}
var request = new Ajax.Request(rpc_url, {
method: 'get', parameters: qstring,
onSuccess: RPCListUserStatesJsonProcessData,
onFailure: RPCListUserStatesJsonHandleAjaxError
});
Element.show('user_state_div');
} else {
Element.hide('user_state_div');
}
var collection = document.getElementById('user_state_div').getElementsByTagName('INPUT');
for(var i=0; i<collection.length; i++) {
if ((collection[i].type.toUpperCase()=='CHECKBOX') && (collection[i].checked == true)){
collection[i].checked = false;
}
}
}
function ShowUserStatesOffline() {
tmp = $F("image_id").split(/-/, 4);
usmt_deploy_task = tmp[2];
offline_scan_id = tmp[3];
// Clean the elements
$('offline_scan_status').innerHTML = '';
Element.hide('offline_scan_status');
Element.hide('offline_scan_div');
Element.hide('user_state_div');
// Disable offline user state scan from remote site
if(VBFileExists('Y:\\hta\\disable_capture.txt')) {
offline_scan_id = 0;
}
if(offline_scan_id != 0 && offline_scan_id != null) {
Element.show('offline_scan_div');
// Get the list of USMT scan template available on server
if(typeof(usmt_templates) === 'undefined') {
usmt_templates = JSGetUSMTTemplates();
if('error_contacting' == usmt_templates) {
var opt = document.createElement('OPTION');
opt.text = 'Error contacting server';
$('usmt_template').add(opt);
} else {
var defaultOpt = document.createElement('OPTION');
defaultOpt.text = 'Default';
defaultOpt.value = 1;
$('usmt_template').add(defaultOpt);
for(var i = 0, usmt_template = usmt_templates[0];
i < usmt_templates.length;
usmt_template = usmt_templates[++i]) {
var opt = document.createElement('OPTION');
opt.text = usmt_template.name;
opt.value = usmt_template.id;
$('usmt_template').add(opt);
}
}
}
// Fetch the profile list available on the machine
if(typeof(offline_profile_list) === 'undefined') {
$('offline_scan_status').innerHTML = 'Fetching profile list …';
Element.show('offline_scan_status');
offline_profile_list = JSFetchProfileList(work_dir);
}
// Show the profile list
UpdateUserStatesOffline();
}
ShowUserStates();
}
function UpdateUserStatesOffline() {
// Get the selected USMT scan template details
usmt_template_id = $F('usmt_template');
exclude_profiles = '';
scan_all = 0;
if(usmt_template_id > 1) {
var template = JSGetUSMTTemplateData(usmt_template_id);
exclude_profiles = String(template.exclude_profiles);
scan_all = template.scan_all;
}
if(offline_profile_list == '' || offline_profile_list.match(/^Error:/)) {
var msg = JSGetOfflineScanErrorMessage(offline_profile_list);
$('offline_scan_status').innerHTML = msg;
} else {
$('offline_scan_status').innerHTML = '';
Element.hide('offline_scan_status');
var element = document.getElementById('offline_user_states');
JSShowProfileList(element, offline_profile_list, exclude_profiles, scan_all, usmt_deploy_task);
Element.show('offline_profile_list_div');
}
}
</script>
</head>
<body onload="RPCListSystemImagesJson();">
<h1>Windows Imaging</h1>
<div class="list">Image Name: <select name="image_id" id="image_id" onChange="$('usmt_version').selectedIndex = 0;ShowUserStatesOffline();"></select></div>
<div id="offline_scan_div" style="display:none">
<div class="list">User Profiles Available On This Machine:</div>
<div class="list" id="offline_scan_status" style="font-size: 14px; display:none"></div>
<div id="offline_profile_list_div" style="display:none">
<div class="list" style="font-size: 14px;">USMT scan template to be used:<select name="usmt_template" id="usmt_template" onChange="UpdateUserStatesOffline();"></select></div>
<p class="list" style="font-size: 14px;">Please confirm the user state action as outlined below.</p>
<div id="offline_user_states" class="list"></div>
</div>
</div>
<div id="scan_log_div" style="display:none">
<div class="list"></div>
<div class="list">Scan Status log:</div>
<div class="list" id="scan_log"></div>
</div>
<div id="user_state_div" style="display:none">
<div class="list">User States Available On The Server:</div>
<p class="list" style="font-size: 14px;">Please select the user states you want to deploy on this machine.</p>
<div class="list">User states scanned with: <select name="usmt_version" id="usmt_version" onChange=ShowUserStates()></select></div>
<table class="list" border="1" cellspacing="0" width=964>
<tr style="margin-bottom:-2px">
<th>
<input class="checkbox_label" type="checkbox" onclick="temp = this.checked; $$('input[type=checkbox]').each(function(e) { if(e.name == 'selected_profiles') { e.checked = temp; } })">
</th>
<th width=150>Profile Name</th>
<th width=150>Hostname</th>
<th width=150>Created</th>
<th width=100>Domain</th>
<th width=150>Operating System</th>
<th width=50>Arch</th>
<th width=120>USMT Version</th>
<th width=70>Size</th>
<th width=70>Template Used</th>
<tr>
<tbody id="user_states" style="margin-top:-2px"></tbody>
</table>
<div class="list" id="user_state_error" style="font-size: 14px;"></div>
</div>
<div class="list" id="restart_automatic">
<input type="checkbox" name="opt_restart" value="-restart" />
Restart Automatically after deployment</div>
<div class="list" id="start_deploy"><img src="images/icons/harmony/go_32.gif" align="absmiddle" /><a href="#" id="deploy_drives" onclick="if(!this.disabled) { DeployDrives('en_US.UTF-8'); } return false;">Start deploy</a></div>
<div id="logdiv" style="display:none">
<br>
<h1>Deploy log:</h1>
<pre id="log" style="border: 1px solid #888; padding: 2px; margin-top: .5em; width: 750px; height: 150px; overflow: scroll;"></pre>
</div>
<div class="list"><img src="images/icons/kace/t_32.gif" /></div>
<div class="list"><img src="images/icons/harmony/back_32.gif" align="absmiddle" /><a href="imaging.html">Back to Imaging Menu</a></div>
<div class="list"><img src="images/icons/harmony/home_32.gif" align="absmiddle" /><a href="start.html">Back to Main Menu</a></div>
</body>
</html>
Comments:
-
I'm running version 3.7.120345 and I get this every time I deploy an image. Mine states "Unable to get property 'replace' of undefined or null reference"
Line: 132
Char: 5
That line in my file reads:
$('log').appendChild(document.createTextNode(log.replace(/\x0a/g, ''))); - shanksr 8 years ago