|
I said I would research this, so I am. I know little about VB or VBSCRIPT. There is an admin where I work that is facing the daunting challenge of 100s of new users coming into our facility. 99% of the users will receive a canned Windows 7 machine with limited privs - meaning no local admin meaning no ability to install printer drivers.
He uses the following script now (snippet):
Set WshNetwork = WScript.CreateObject("WScript.Network")
PrinterPath = "\\dulpqs51\dulprn126"
WshNetwork.AddWindowsPrinterConnection PrinterPath
WshNetwork.SetDefaultPrinter PrinterPath
-----
When users execute this script, they receive a "please supply the admin info" prompt. He asked me if there was some way to add a username/password to the script without giving away the information. I don't think there is. I know there are username and password parameters that can be passed, but I don't know about a secure way to include this in the script.
Thoughts and Ideas?
Charlie Gilley
<italic>You're going to tell me what I want to know, or I'm going to beat you to death in your own house.
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
There is no scure way to do this in VBScript. But there MAY be alternaitves.
When is this script being executed?? Under what account??
|
|
|
|
|
The script is only executed when a standard user - from their standard account - desires to add a printer to the computer.
Charlie Gilley
<italic>You're going to tell me what I want to know, or I'm going to beat you to death in your own house.
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
In that case, the script is running AS the user and has the users permissions. There is nothing you can do about it as VBScript doesn't have any facility to impersonate another user, like an admin.
Usually, normal users can add printers themselves. Soooo, I take it this was turned off in your Win7 load or by policy?
|
|
|
|
|
Hard to say why things are done around here . It may be that if a user were to launch the install file for the printer, it would work, and it's the script implementation that has issues. I'm just not sure.
I'll toss it over as a suggestion.
Appreciate the feedback.
Charlie Gilley
<italic>You're going to tell me what I want to know, or I'm going to beat you to death in your own house.
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
If the domain is an Active Directory, admin can use GPOs to assign printers to users.
No memory stick has been harmed during establishment of this signature.
|
|
|
|
|
I am getting a syntax error in this SQL statement. But i can't figure out what it is.
Dim sql As String = "INSERT INTO Users (UserID, Password, CompleteName, Admin) VALUES (@User, @Pass, @Complete, @admin)"
Whole code segment is below
Dim sql As String = "INSERT INTO Users (UserID, Password, CompleteName, Admin) VALUES (@User, @Pass, @Complete, @admin)"
Dim com As New OleDb.OleDbCommand
com.Parameters.Add("@User", OleDb.OleDbType.Char).Value = txtUser.Text
com.Parameters.Add("@Pass", OleDb.OleDbType.Char).Value = txtpass.Text
com.Parameters.Add("@Complete", OleDb.OleDbType.Char).Value = txtcomplete.Text
com.Parameters.Add("@admin", OleDb.OleDbType.Char).Value = isadm
what is the error of SQL statement.
|
|
|
|
|
When the syntax error isn't obvious, most often it is due to a field name matching a keyword; the remedy is to put them all inside square brackets. As in [password] .
|
|
|
|
|
It's working. thanks a lot.
|
|
|
|
|
Are you missing this statement ?
com.commandText = SQL
|
|
|
|
|
Hi guys, I am new to VB.net, I would like to know how to create a result classification program in such a way that:
1. a user will input a number
2. The output will be displayed, showing the grade based on the following table
0-40 Fail
41-50 Pass
51-60 Merit
61 and over Distinction
Please help.
|
|
|
|
|
Just state the requirements out aloud to yourself, and the workflow will come directly from that like this
get number from user.
if number is less than 40 then
output "Fail"
else if number is greater than or equal to 40 and number is less than 50
output "Pass"
else if number is greater than or equal to 50 and number is greater than 60
output "Merit"
else
output "Distinction"
From that I am sure you can work out the exact VB.Net code.
Edited - thanks to Luc
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
modified 16-Feb-12 8:14am.
|
|
|
|
|
merit: none, distinction: none
|
|
|
|
|
Maybe so, but at least he didn't the guys homework for him!
|
|
|
|
|
yep, however pass is the best he can hope for.
|
|
|
|
|
You lost me
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
then check your pseudo-code.
|
|
|
|
|
|
it wasn't an OR, it was an AND operator that would have fit the bill.
However there is no need to invert the previous test condition as you are already using an ELSE.
Using less code would have avoided the mistake from the start.
|
|
|
|
|
It was obvious when I went back to check - I was just trying to get the OP to try and think it through
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
Thank you. I have read abit about it and with your directions, i got the understanding of how to do it better.
Thanks.
|
|
|
|
|
i want double like this in vb.net. 1.25 instead of 1.254789. how can i?
|
|
|
|
|
Look at the Math.Round() function, or at string.Format("{0:D2}",myDouble)
|
|
|
|
|
|
I have a form with 4 datagrids, 3 of which are on a tabcontrol. All the grids are coming from the same source. The problem I'm running into is the grids on Tabs2 and 3 are not displaying the data. I stepped though the code and it's there but not displaying. I also changed the tab order to see if I had a code issue but again the grid in tab1 is the only one displayed. This is what I have for code:
For Each dgv As DataGridView In {dgvMain, dgvTab1, dgvTab2, dgvTab3}
dgv.DataSource = ds.Tables("TaskList")
dgv.AutoGenerateColumns = False
Next
Dim dgvRow As Integer = 0
Do Until (i = 15)
dgvMain.Item("RetrievalKey", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("RetrievalKey")
dgvMain.Item("TaskDescription", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("TaskDescription")
dgvMain.Item("LastDoneOn", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("LastDoneOn")
dgvMain.Item("Agent", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("Agent")
dgvMain.Item("AgentOrder", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("AgentOrder")
dgvMain.Item("Query", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("Query")
dgvTab1.Item("Param0", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("Param0")
dgvTab1.Item("Param1", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("Param1")
dgvTab1.Item("Param2", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("Param2")
dgvTab1.Item("Param3", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("Param3")
dgvTab1.Item("Param4", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("Param4")
dgvTab2.Item("Param5", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("Param5")
dgvTab2.Item("Param6", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("Param6")
dgvTab2.Item("Param7", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("Param7")
dgvTab2.Item("Param8", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("Param8")
dgvTab2.Item("Param9", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("Param9")
dgvTab3.Item("ErrorMessage", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("ErrorMessage")
dgvTab3.Item("QueryPath", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("QueryPath")
dgvRow += 1
i += 1
Loop
dgvMain and dgvTab1 display, but not 2 or 3. However there are empty cells displaying. Any help will be much appreciated...
|
|
|
|