Solved

Windows XP Reg Add function .

Posted on 2004-10-11
7
2,177 Views
Last Modified: 2012-05-05
Okay , here's my problem.

I run this command on a web page on windows NT machines and it works fine ... it doesnt work when you run it on XP machines tho :/

var cmdln = 'cmd /k reg update "HKEY_LOCAL_MACHINE\\'+
                 'SYSTEM\\CurrentControlSet\\Control\\'+
                 'Session Manager\\Memory Management\\'+
                  'pagingfiles"="C:\\pagefile.sys 256 256" '+''+assetnumber+'';

var shell=new ActiveXObject("WScript.shell");
shell.run(cmdln);

.. managed to figure out that there was no reg update function in XP ( wooh go me :/ ) , so changed the script slightly... to this :

var cmdln = 'cmd /k reg add "\\\\'+assetnumber'+\\HKLM\\SYSTEM\\'+
                                           'CurrentControlSet\\Control\\'+
                                           'Session Manager\\Memory Management\\'+
                                           '/v PagingFiles /t REG_MULTI_SZ /d C:\pagefile.sys\0256\0256 /f"';

var shell=new ActiveXObject("WScript.shell");
shell.run(cmdln);

but recieve the error : invalid Key name

ignore the '+assetnumber+' please as this is part of another script in the page ... I have however removed it from the page to try the command and still recieve the error ..

this command works in a command prompt window : reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v PagingFiles /t REG_MULTI_SZ /d C:\pagefile.sys\0256\0256 /f

anyone any idea's as to how i'm entering the incorrect syntax for this. ?? thanks in advance much appreciated.
0
Comment
Question by:bRvO
  • 4
  • 3
7 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 500 total points
Comment Utility
I would suspect it's the space between Session Manager & Memory Management but have yet to find a suitable workaround for this problem.  Hope someone has an answer for you.
0
 
LVL 5

Author Comment

by:bRvO
Comment Utility
That's what I thought too , as when i entered it in the command prompt window , I had to enclose the key in "" to get it to work ... not sure on how i can resolve it though ... have tried enclosing the lot in "" or even ' ' , same error each time :/

cheers anyway :x
0
 
LVL 67

Assisted Solution

by:sirbounty
sirbounty earned 500 total points
Comment Utility
Not sure about that assetnumber, but it appears you have your ' before your +
would that cause the problem?

Also, how about adding in some quotations...

var cmdln = 'cmd /k reg add "\\\\'+assetnumber'+\\' + chr(34) + 'HKLM\\SYSTEM\\'+
                                           'CurrentControlSet\\Control\\'+
                                           'Session Manager\\Memory Management\\'+ chr(34) +
                                           '/v PagingFiles /t REG_MULTI_SZ /d C:\pagefile.sys\0256\0256 /f"';
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 5

Author Comment

by:bRvO
Comment Utility
yeah , that would cause a problem with adding the asset number .. if managed to get it to work without the assetnumber part ...

this is what i used

car cmdln = 'cmd /k reg add "HKLM\\SYSTEM\CurrentControlSet\\Control\Session Manager\\Memory Management" /v PagingFiles /t REG_MULTI_SZ /d "C:\pagefile.sys 1024 1024" /f';

that changes the Virtual Memory on any XP machine that runs the web page...

just got to add the assetnumber part now :o

thanks for your help ... :)
0
 
LVL 5

Author Comment

by:bRvO
Comment Utility
done it . pretty simple really :/

var cmdln = 'cmd /k reg add "\\\\'+assetnumber+'\\HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management" /v PagingFiles /t REG_MULTI_SZ /d "C:\\pagefile.sys 1024 1024" /f';


(all one line )

when the prompt appears as the page loads ... just enter the netbios/ip address of the remote machine and click ok ... comman completed succesfully appears . checked the remote machine and it works.

for anyone who's interested .. the local machine needs to have ActiveX enabled ( all settings )

and this needs to be in the page header

<html>
<head>




var assetnumber= prompt('please enter asset number',' ');

if ( (assetnumber==' ') || (assetnumber==null) )
 {
      assetnumber="ERROR";
 }



</head>
0
 
LVL 5

Author Comment

by:bRvO
Comment Utility
cheers for your help .... your comments provided me with that little bit extra that I needed to get the result .

thanks :D
0
 
LVL 67

Expert Comment

by:sirbounty
Comment Utility
Wow - thank YOU. : )
Happy to assist in any way I can.  Glad you got it working.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
windows 10 install 6 93
Move XP PC to Vmware 22 127
HP PC Hardware Diagnostics UEFI 11 76
How Do I Set Up XP Mode in Windows 7? 8 59
Ok I have been working on this for some time having learned and gained certification in XenDesktop 4 along came version 5 which was released last month. Since then I have been working to deploy XenDesktop 5 in a small environment with only 2 virt…
Issue: Unstable cursor in Windows XP and Windows runs extremely slow in that any click will bring up the Hour glass (sometimes for several seconds before giving you what you want) . Troubleshooting Process and the FINAL FIX: This issue see…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now