Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 136,405 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 2,463 people online right now. Registration is fast and FREE... Join Now!




Modifying Shell Commands

 
Reply to this topicStart new topic

Modifying Shell Commands

jclegg42002
27 Aug, 2008 - 02:45 PM
Post #1

New D.I.C Head
*

Joined: 14 Aug, 2008
Posts: 10


My Contributions
CODE
Function Main()

    Dim WSHShell, objWMIService, objComputer, colComputer, strComputer

    WSHShell = CreateObject("WScript.Shell")
    strComputer = "."
    objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    colComputer = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")

    WSHShell.RegWrite "HKCR\*\Shell\MenuText\Command\", "cmd.exe /C " & "runas /user:", objComputer.UserName, "-ds" & vbTab & Chr(34) & "%1"
    WSHShell.RegWrite "HKCR\*\Shell\MenuText\", "Runas With -ds Account"
    
End Function


Can anyone tell me where I have gone wrong with this code, I could have sworn it was working, then I retried and I cant get it to execute to the registry. Thanks!
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Modifying Shell Commands
27 Aug, 2008 - 03:49 PM
Post #2

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 8,992



Thanked: 125 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Are you receiving any errors? Does this code not work that way you intended it? When asking for help there are a couple items that are vital in order for someone to properly help you:

  • Post the code you're having problems with (CHECK)
  • Post the exact error you're receiving, if you are receiving one
  • If no error explain what the code is doing versus what you want it to do

User is online!Profile CardPM
+Quote Post

jclegg42002
RE: Modifying Shell Commands
27 Aug, 2008 - 03:57 PM
Post #3

New D.I.C Head
*

Joined: 14 Aug, 2008
Posts: 10


My Contributions
No error, execute it in cmd shell, all successful, but its not writing those 2 strings to the registry like it should, so in all honesty, im not sure 'what the code' is doing.
User is offlineProfile CardPM
+Quote Post

jclegg42002
RE: Modifying Shell Commands
27 Aug, 2008 - 05:02 PM
Post #4

New D.I.C Head
*

Joined: 14 Aug, 2008
Posts: 10


My Contributions
psychocoder I think your like the only who replies to my posts ha
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 11:55AM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month