Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Convert Batch to VBScript

Posted on 2011-03-23
5
Medium Priority
?
660 Views
Last Modified: 2012-06-27
hey can someone help me to convert this batch to vbscript for win 7?

1. reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /d Pelephone /f
2. net user Administrator /active:no
3. RD /S /Q "C:\Windows.old"


BTW if it's possible i want to be able to call the script with cscript SCRIPT.wsf  
thnx
0
Comment
Question by:siltech
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 65

Accepted Solution

by:
RobSampson earned 2000 total points
ID: 35203207
Hi, this is the converted code, but UAC will most likely get in the way for these actions.

Regards,

Rob.
Set objShell = CreateObject("WScript.Shell")
Set objNetwork = CreateObject("WScript.Network")
Set objFSO = CreateObject("Scripting.FileSystemObject")

objShell.RegWrite "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultUserName", "Pelephone", "REG_SZ"

strComputer = objNetwork.ComputerName
Set objUser = GetObject("WinNT://" & strComputer & "/Administrator")
objUser.AccountDisabled = False
objUser.SetInfo

objFSO.DeleteFolder "C:\Windows.old", True

Open in new window

0
 
LVL 65

Expert Comment

by:RobSampson
ID: 35451758
LeeTutor, seeing as my code will work if UAC is disabled, and it's the only comment, it should be accepted as the answer.

Regards,

Rob.
0
 
LVL 59

Expert Comment

by:LeeTutor
ID: 35687867
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
On some Windows 7 (SP1) computers, Windows Update becomes super slow even the computer is reasonably fast.  There's one solution that seemed to have worked well for me (after trying a few other suggested solutions).
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

618 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