newsgroups
Sun Apr 10 09:06:28 CDT 2005
batch file works, thank you very much.Does everything I need.
"Rafael T" <okinawapro@hotmail.com> wrote in message
news:eacFcNJPFHA.1884@TK2MSFTNGP15.phx.gbl...
> what if an admin loses the flash drive? You don't want people to be able
> to read the admin password.
>
> anyway you can do:
> - Call the vbscript from a one line batch file using:
> runas /user:computer\administrator "cscript \"vbscriptName.vbs\" "
>
> When run, it will ask for the administrator password.
>
> - The other way around is to do something like this an include it on the
> vscript itself. You can read it in:
>
http://www.tek-tips.com/faqs.cfm?fid=2760
>
> - I thought there was a way to actually have it in vbscript, but I guess
> that's for networking.
>
> hope this helps,
> RT
>
>
>
> "newsgroups.comcast.net" <chiller-fx@comcast.net> wrote in message
> news:%23mG1%23KHPFHA.2704@TK2MSFTNGP15.phx.gbl...
>> The way I'm running the vbscript is it's stored on a flash drive which
>> only admin people have, i figured there might be an easier way of doing
>> this other then logging the user off and logging in as an admin. So
>> storing the username/password in the file won't really be an issue.
>>
>> The "Run as.." option for some reason doesn't show up, that was going to
>> be the way of doing it. It shows up when installing applications to the
>> computer, but not with a vbs file.
>>
>>
>> "Rafael T" <okinawapro@hotmail.com> wrote in message
>> news:O0iSKWAPFHA.3356@TK2MSFTNGP12.phx.gbl...
>>> the problem is that if you place the username and password on the
>>> vbscript itself, it will be visible to the user who runs the script (not
>>> safe)
>>>
>>> You can try "Run as..." to run the script from the user account. you
>>> will have to type in the administrator account and password.
>>>
>>> right click on the script and from the menu click on run as... then the
>>> system will show you a log on screen. Only that script will run under
>>> the new user security.
>>>
>>> hope this helps,
>>> Rafael
>>>
>>>
>>>
>>> "newsgroups.comcast.net" <chiller-fx@comcast.net> wrote in message
>>> news:O1YlGS7OFHA.3788@tk2msftngp13.phx.gbl...
>>>> Thank You, I put something together from your code to modify the file.
>>>> Now all I need is a way to check if the user logged in has Admin
>>>> privileges?
>>>>
>>>> Also if the user doesn't have admin privileges is there a way to run
>>>> the vbscript on a non-admin account as an admin assuming the username
>>>> and password of the admin account is known?
>>>>
>>>> "Rafael T" <okinawapro@hotmail.com> wrote in message
>>>> news:OKc7cuyOFHA.3292@TK2MSFTNGP12.phx.gbl...
>>>>> what exactly do you have in mind?
>>>>> if it is a matter of adding entries, it is quite simple
>>>>>
>>>>>
>>>>> Dim fsoObject, open_File, target_File
>>>>> Set fsoObject = WScript.CreateObject("Scripting.FileSystemObject")
>>>>>
>>>>> ' ### set the file name to include the variable from the process above
>>>>> target_File = "C:\WINDOWS\system32\drivers\etc\Hosts"
>>>>>
>>>>> If (fsoObject.FileExists(target_File)) Then
>>>>> Set open_File = fsoObject.OpenTextFile(target_File, 8)
>>>>> Else
>>>>> Set open_File = fsoObject.OpenTextFile(target_File, 2, "True")
>>>>> End If
>>>>>
>>>>>
>>>>> open_File.WriteLine "ip pcname"
>>>>>
>>>>>
>>>>> msgbox "done"
>>>>> open_File.Close()
>>>>>
>>>>> hope this helps,
>>>>> RT
>>>>>
>>>>> "newsgroups.comcast.net" <chiller-fx@comcast.net> wrote in message
>>>>> news:%23d8mZKyOFHA.2680@TK2MSFTNGP09.phx.gbl...
>>>>>> Hey,
>>>>>>
>>>>>> Anyone know how to write a simple little script to modify the HOST
>>>>>> file?
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>