Click here to Skip to main content
15,894,343 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: call a Sub with a dynamic type parameter. Pin
Richard MacCutchan2-Jan-19 22:10
mveRichard MacCutchan2-Jan-19 22:10 
GeneralRe: call a Sub with a dynamic type parameter. Pin
desanti3-Jan-19 4:35
desanti3-Jan-19 4:35 
GeneralRe: call a Sub with a dynamic type parameter. Pin
Richard MacCutchan3-Jan-19 6:33
mveRichard MacCutchan3-Jan-19 6:33 
GeneralRe: call a Sub with a dynamic type parameter. Pin
Dave Kreskowiak3-Jan-19 6:36
mveDave Kreskowiak3-Jan-19 6:36 
AnswerRe: call a Sub with a dynamic type parameter. Pin
Eddy Vluggen2-Jan-19 22:14
professionalEddy Vluggen2-Jan-19 22:14 
GeneralRe: call a Sub with a dynamic type parameter. Pin
desanti3-Jan-19 4:35
desanti3-Jan-19 4:35 
GeneralRe: call a Sub with a dynamic type parameter. Pin
Ralf Meier17-Jan-19 0:34
mveRalf Meier17-Jan-19 0:34 
QuestionDirecotoryServices - Find all Windows 7 and Windows 10 Computers in Domain Pin
Member 1186689325-Dec-18 6:43
Member 1186689325-Dec-18 6:43 
I am creating a tool to delete user profiles by age on all windows 7 and windows 10 devices on our domains. I have it working using this filter ("(objectClass=computer)") but want to refine that to only get windows 7 and windows 10 devices because my department manages desktops/laptops not servers. In order to make the tool more efficient and not attempt to connect to devices I don't have admin access to.

So I tried this filter... mySearcher.Filter = "(&(objectClass=computer)(operatingSystemVersion=*server*))" my thought was to do something like this if OS IsNot Windows Server 2012 or Windows Server 2008 then do something.

I loaded the operatingSystem property but can't get it to display. I have tried it in the datagridview and when that didn't work I just tried to do a consolewriteline and that didn't work either. I want to test my concept before adding the code to use WMI to delete profiles by just displaying the hostname and OS version to make sure it is pulling the information from AD and not giving me servers. Can someone help? Here is the code(I am just working with the v06 domain at the moment):

Dim mySearcher As DirectorySearcher = New DirectorySearcher(enTry)
       mySearcher.PropertiesToLoad.Add("dNSHostName")
       mySearcher.PropertiesToLoad.Add("operatingSystem")
       mySearcher.PropertiesToLoad.Add("operatingSystemVersion")
       mySearcher.Filter = "(&(objectClass=computer)(operatingSystem=*server*))" '("(objectClass=computer)")

       Dim resEnt As SearchResult
       For Each resEnt In mySearcher.FindAll()
           Select Case dMain
               Case "v06"
                   Try

                       hostName = GetProperty(resEnt, "dNSHostName")
                       OSystem = GetProperty(resEnt, "operatingSystem")
                       Dim result1 As Net.NetworkInformation.PingReply = ping.Send(hostName, 1000)
                       If result1.Status = Net.NetworkInformation.IPStatus.Success Then
                           Dim row2 As String() = New String() {hostName, "N/A", OSystem}
                           dgvLocal.Rows.Add(row2)
                       Else
                           My.Computer.FileSystem.WriteAllText("C:\ExodusErrorLog.txt", hostName & " - Device is not pingable!" & vbCrLf & vbCrLf, True)
                       End If
                   Catch ex As Exception
                       My.Computer.FileSystem.WriteAllText("C:\ExodusErrorLog.txt", hostName & " - " & ex.Message & vbCrLf & vbCrLf, True)
                   End Try
               Case "v07.med.va.gov"
           End Select
       Next


modified 25-Dec-18 13:32pm.

AnswerRe: DirecotoryServices - Find all Windows 7 and Windows 10 Computers in Domain Pin
Eddy Vluggen2-Jan-19 23:02
professionalEddy Vluggen2-Jan-19 23:02 
QuestionThreading, Invoke, Delegate and MethodInvoker... Pin
Member 1111281423-Dec-18 3:03
Member 1111281423-Dec-18 3:03 
AnswerRe: Threading, Invoke, Delegate and MethodInvoker... Pin
Eddy Vluggen23-Dec-18 10:52
professionalEddy Vluggen23-Dec-18 10:52 
GeneralRe: Threading, Invoke, Delegate and MethodInvoker... Pin
Member 1111281423-Dec-18 11:09
Member 1111281423-Dec-18 11:09 
GeneralRe: Threading, Invoke, Delegate and MethodInvoker... Pin
Eddy Vluggen23-Dec-18 11:14
professionalEddy Vluggen23-Dec-18 11:14 
QuestionVB Client server with timer Pin
Member 1409761321-Dec-18 21:49
Member 1409761321-Dec-18 21:49 
AnswerRe: VB Client server with timer Pin
Richard MacCutchan21-Dec-18 22:00
mveRichard MacCutchan21-Dec-18 22:00 
GeneralRe: VB Client server with timer Pin
Member 1409761321-Dec-18 22:16
Member 1409761321-Dec-18 22:16 
AnswerRe: VB Client server with timer Pin
Dave Kreskowiak22-Dec-18 4:12
mveDave Kreskowiak22-Dec-18 4:12 
QuestionHow to get a list of installed applications and uninstall them ? Pin
Lucifer Morningstar19-Dec-18 22:59
Lucifer Morningstar19-Dec-18 22:59 
SuggestionRe: How to get a list of installed applications and uninstall them ? Pin
CHill6019-Dec-18 23:07
mveCHill6019-Dec-18 23:07 
AnswerRe: How to get a list of installed applications and uninstall them ? Pin
Richard MacCutchan19-Dec-18 23:22
mveRichard MacCutchan19-Dec-18 23:22 
AnswerRe: How to get a list of installed applications and uninstall them ? Pin
Eddy Vluggen20-Dec-18 0:39
professionalEddy Vluggen20-Dec-18 0:39 
QuestionTrying to create a search query that will bring the results searched in access database. It is bringing up an error runtime error '3075' Pin
Member 1409033914-Dec-18 22:07
Member 1409033914-Dec-18 22:07 
AnswerRe: Trying to create a search query that will bring the results searched in access database. It is bringing up an error runtime error '3075' Pin
Richard MacCutchan14-Dec-18 22:51
mveRichard MacCutchan14-Dec-18 22:51 
GeneralRe: Trying to create a search query that will bring the results searched in access database. It is bringing up an error runtime error '3075' Pin
Member 1409033915-Dec-18 5:22
Member 1409033915-Dec-18 5:22 
AnswerRe: Trying to create a search query that will bring the results searched in access database. It is bringing up an error runtime error '3075' Pin
Dave Kreskowiak15-Dec-18 5:16
mveDave Kreskowiak15-Dec-18 5:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.