?
Solved

Convert Batch to VBScript

Posted on 2011-03-23
5
Medium Priority
?
659 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.
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…
Suggested Courses
Course of the Month8 days, 9 hours left to enroll

764 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