What's new

Can some Help please? VBS to VB.net (VB 2010)

  • Thread starter R_B_EAZIE
  • Start date
  • Views 242
R

R_B_EAZIE

The Robin Hood of GTA
Messages
385
Reaction score
134
hello Guys,

Is there anyone here that could help me out, I have a VBS script that i would like to translate and use in Visual studio 2010,

'''FINDING THE USERS SID
struser = InputBox ("USER")
struser2 = "'" & struser & "'"
'WScript.Echo struser2
Set objNetwork = CreateObject("WScript.Network")
Set objShell = CreateObject("WScript.Shell")
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set objAccount = objWMIService.Get("Win32_UserAccount.Name="& struser2 &",Domain='" & objNetwork.UserDomain & "'")
strValue = objAccount.SID

WScript.Echo "SID is " & strValue


all the vbs does is query a domain users SID and display it for me, id like it in VS2010 so i can carry on with further functions and also create a GUI,

thanks in advance
 
R

R_B_EAZIE

The Robin Hood of GTA
Messages
385
Reaction score
134
ok i've found this

Dim id AsSystem.Security.Principal.WindowsIdentity=Security.Principal.WindowsIdentity.GetCurrent()MessageBox.Show(id.User.AccountDomainSid.ToString())

returns my SID fine - any one know where i can adjust the coed to take another user?
 
S

Sto 2 da b

Enthusiast
Messages
273
Reaction score
62
Why you going to vs10? Just go to vs13 and save yourself from the hassles of vs10.
 
R

R_B_EAZIE

The Robin Hood of GTA
Messages
385
Reaction score
134
how does vs13 differ to vs10?
 
S

Sto 2 da b

Enthusiast
Messages
273
Reaction score
62
I have used both VS 10 and VS 13 at work and by far the performance is much better now. The graphics of it has been changed, which doesn't seem like much but it is much more user friendly. Also, it has a lot of new features regrading store apps, which is one of the reasons I like it.
 
R

R_B_EAZIE

The Robin Hood of GTA
Messages
385
Reaction score
134
I have used both VS 10 and VS 13 at work and by far the performance is much better now. The graphics of it has been changed, which doesn't seem like much but it is much more user friendly. Also, it has a lot of new features regrading store apps, which is one of the reasons I like it.
Nice ill look into that then,

and leave this here in case anyone needed to know the answer

Dim asu As New System.Security.Principal.NTAccount("username")
Dim si As System.Security.Principal.SecurityIdentifier = asu.Translate(GetType(System.Security.Principal.SecurityIdentifier))
 
Top Bottom