Solved

Convert Batch to VBScript

Posted on 2011-03-23
5
657 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 500 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

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.

749 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