|
I'm performing a sweep of my network by checking the AD and pinging machine listed. I'll be doing a lot more with this later, but for now I'm trying to see if a PC is disabled in the AD so I wont waste time pinging it. I've done a bit of work with writing scripts to query the AD, but VB is different enough to confuse me in a few places.
This is what I have so far. I have the spot marked where I need help.
Private Sub Sweep()
Dim dlgres As String
dlgres = MessageBox.Show("Do you wish to continue?", _
"Continue?", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If dlgres = DialogResult.Yes Then
lbComputers.Items.Clear()
Dim DirEntry As New DirectoryEntry("LDAP://" & tbDomain.Text)
Dim DirSearch As New DirectorySearcher(DirEntry)
Dim strPcName As String
Dim strPcOutput As String
Dim strPcStatus As String
Dim intcounter As Integer
DirSearch.Filter = "(objectClass=computer)"
intcounter = 0
For Each sr As SearchResult In DirSearch.FindAll
intcounter += 1
strPcName = sr.GetDirectoryEntry.Name.ToString.Substring(3)
*********************************************************************************
This is where I want to see if a PC is Disabled. I can add the If routine later.
strPcStatus = (Code to determine if disabled)
(maybe some form of sr.GetDirectoryEntry.something...?)
**********************************************************************************
(If Not Disabled)
Try
If My.Computer.Network.Ping(strPcName, 100) Then
'If You Can Ping The PC
strPcOutput = String.Concat(strPcName, " <--- Active")
lbComputers.Items.Add(strPcOutput)
'MessageBox.Show(strPcOutput)
Else
'If You Can't Ping The PC
strPcOutput = String.Concat(strPcName, " <--- Not Active")
lbComputers.Items.Add(strPcOutput)
'MessageBox.Show(strPcOutput)
End If
Catch
'If You Can't Resolve The IP To Ping The PC
strPcOutput = String.Concat(strPcName, " <--- Cannot Resolve")
lbComputers.Items.Add(strPcOutput)
End Try
pbProgress.Value = ((intcounter / intNumPCs) * 100)
Next
lbComputers.SelectedIndex = 0
intNumPCs = lbComputers.Items.Count
lblNumPCs.Text = "# of PC's in AD = " & intNumPCs
End If
End Sub
I'm sure it's simple.
|
|
|
|
|
Well, I don't have any code to show you, but you need to check the "User-Account-Control" property of the Computer account to see if a flag is set. This means doing some math to see if a certain bit is set, specifically, the AccountDisabled bit is &h00000010, or in decimal, 2. If the UAC value you get back is, say, 511, you can do this to find out if the AccountDisabled bit is set:
Dim disabled As Integer = uacValue And &H00000010
If disabled = 2 Then
' The account is disabled
End If
|
|
|
|
|
Hi All,
I need code or way so I can insert any text or number into textbox and convert it to barcode format. any help plz
Regards
|
|
|
|
|
Search the forums, there are lots of posts like this and fonts that will do the job
Searching[^] will help you come up with a lot of answers, code39 is the most popular from a quick search of the forums[^]
|
|
|
|
|
Yes, this question comes up all the time and the same answer of "have the decency of doing a search" generally bubbles up.
It probably took more time to create the post and using the search button. Sigh.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
thanks I do this already, but no answer found.
regards
|
|
|
|
|
|
Then you didn't really do a search. Seriously, this has been so over-documented that you can't help but to find answers.
Google results for "VB.NET number to barcode"[^].
|
|
|
|
|
Glad we could 'service' you and thanks for the "wonderful" score Mr. Wonderful. snicker...snicker
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
This is where this question belonged, but you cross posted to the ASP.NET forum. Please don't crosspost.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
this forum founded to service us, so I don't think so it is a problem when posting this question here or in ASP.Net especially when I'm searching for a right answer, anyway it is vb.net code!.
Thanks
|
|
|
|
|
If it is vb.net code, then post in the vb.net section. This forum is here to *HELP* you, not service you. It is here as a bonus, not a requirement. Your solution has been posted, stop antagonizing people at this point.
|
|
|
|
|
So leave this question and save your time, anyway I get the answer. thanks for all helping me not [service me] !.
|
|
|
|
|
-=adds Mr. Wonderful to his "special boneheads to ignore in the future" list=-
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
don't say bad words, this is just misunderstanding, I just simply post question and I need to answer. for all people that reply to me I just Messed some lines when reading quickly their replies and maybe this lead to this misunderstanding, So please Don't bothers and let us just finish this Question.
Regards for All .
|
|
|
|
|
Which only goes to show that you really have no idea about the etiquette of these forums. You need to learn what is regarded as polite by the people who answer here, if you want us to do your work for you.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
http://www.idautomation.com/formscontrols/free/FormsControlManualFreeVersion.html
|
|
|
|
|
thanks a lot that was very helpful.
Regards
|
|
|
|
|
Mr. Wonderful wrote: I need code or way so I can insert any text or number into textbox and convert it to barcode format. any help plz
There are multiple barcode-formats around, which one does you wants? Ean-13 is kinda cute, if you're in Europe.
1) download a barcode-fontset (Google it!)
2) assign this font to Textbox2
3) copy text from Textbox1 to Textbox2
Presto
I are troll
|
|
|
|
|
thank you very much, I already solve this question, but what you post was helpful too.
Regards.
|
|
|
|
|
Hi All:
I want to make a dll by VB. It is dll and not ActiveXDLL.
can you help me? Thanks a lot
chnman
modified on Monday, January 5, 2009 9:18 AM
|
|
|
|
|
Start a Class Library, or Windows Control Library, or Web Control Library, or an Empty project and set it up yourself.
Your question, as asked, doesn't provide enough detail as to what you want to do with this .DLL.
|
|
|
|
|
The kind of dll your looking are called 'classic Dlls' , I dont know the way to build a 'classic Dlls' in VB , but they can be use in VB , to build them you may require VC++
-Regards
Bharat Jain
Phisys Software Solutions Pvt. Ltd.
bharat.jain.nagpur@gmail.com
|
|
|
|
|
Hi there.
I currently have an application where a user can select items from a combo box and then display the results in a datagrid view depending on what is selected in the combo box. This is fine because the user is selcting an exact match from what is in the sql connection but i need the user to be able to select a range from a different combo box, ie - if a field/row in the datagrid is 'Total' then i would want the user to be able to filter out all totals between '100 and 200' or '201 - 300' etc.
I have tried using a case statement but am unsure if this is the right way of going about it.
|
|
|
|
|
Not sure how you have your data setup in the app. If you have a data table, use a dataview to filter the data as needed. The dataview.RowFilter is the where clause in a select statement.
So, just like you would do in SQL, your filter would be something like
"Totals >= 100 and Totals <= 200"
or
"Totals BETWEEN 100 and 200"
I took the example below from the MSDN help which is very descriptive on the dataview.
Private Sub MakeDataView()
Dim view As DataView = New DataView
With view
.Table = DataSet1.Tables("Suppliers")
.AllowDelete = True
.AllowEdit = True
.AllowNew = True
.RowFilter = "City = 'Berlin'"
.RowStateFilter = DataViewRowState.ModifiedCurrent
.Sort = "CompanyName DESC"
End With
' Simple-bind to a TextBox control
Text1.DataBindings.Add("Text", view, "CompanyName")
End Sub
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|