...'
' 1. Add column names for CPU Supports and Current OS
' (Add info to easier identifiablity)
' COMPLETED: 14 July 2015
' **2. Find user last logged on
' (identify main users of said system)
' **3. Find lastLogon in AD for computers not online
' (to see how stale)
' **4. If possible...
...----------------------------------------
' Find MAC
' ----------------------------------------
SET colItems = objWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
' Search for MAC address. Once MAC is found, it is stored into the...
...to WMI on " & strComputer & " - DESCRIPTION NOT CHANGED - FINDMAC"
EXIT FUNCTION
ELSE
SET colItems = objWMIService.ExecQuery _
("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
' Search for MAC address. Once MAC is found, it is stored into the "Function" as...
I must be half asleep - I can't for the life of me figure out why the code is throwing an error. Please help.
SET objFSO = CreateObject("Scripting.fileSystemObject")
SET objFileTEXT = objFSO.OpenTextFile("hosts.txt",2,TRUE)
DO UNTIL objFileTEXT.AtEndOfStream
strComputer =...
Well, depending on what exactly you are trying to do...you may want to do something similar to below:
strInput = Inputbox("Enter text")
DO
SearchFiles(strInput)
LOOP
FUNCTION SearchFiles(strInput)
Your code here...strInput is for file to be searched.
END FUNCTION
Or if you are...
You are awesome...thanks a million.
I made a slight variation to the provided script to get exact information versus having the identifying prefixes. This way - I can compare strings.
strInformation = "john.key ; MAC: 00:18:8B:D6:29:B6 ; IP: 192.168.1.1 ; SN: ####### ; US ARMY ; SPC John Key"...
Whom it may concern: I am trying to find the formula for finding specific sections in a string.
My string format:
<USER> ; <MAC> ; <IP> ; <SN> ; <OFFICE> ; <ADMIN>
Example:
john.key ; MAC: 00:18:8B:D6:29:B6 ; IP: 192.168.1.1 ; SN: ####### ; US ARMY ; SPC John Key
What would be the formula to...
OK, this post is in connection with another post:
http://www.tek-tips.com/viewthread.cfm?qid=1515298&page=1
Let's say I have three specific computer names. And on those three specific computers, I want to change the description field in Active Directory.
What would be the vbscript code for...
...= TRUE
END IF
SET objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
SET colItems = objWMIService.ExecQuery _
("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
' Search for MAC address. Once MAC is found, it is stored into the "Function" as...
...(UCase(TypeName(lngBiasKey)) = "VARIANT()") THEN
lngBias = 0
For k = 0 To UBound(lngBiasKey)
lngBias = lngBias + (lngBiasKey(k) * 256^k)
Next
END IF
' Use ADO to search the domain for all computers.
SET adoConnection = CreateObject("ADODB.Connection")
SET adoCommand =...
...(UCase(TypeName(lngBiasKey)) = "VARIANT()") THEN
lngBias = 0
For k = 0 To UBound(lngBiasKey)
lngBias = lngBias + (lngBiasKey(k) * 256^k)
Next
END IF
' Use ADO to search the domain for all computers.
SET adoConnection = CreateObject("ADODB.Connection")
SET adoCommand =...
Also...you may want to remove the extra "&" sign right before and after text.
Call WshShell.Run("cmd.exe /c C:\robocopy.exe """ & spath & """ """ & dpath & "-.txt"" " & s0)
V/r,
SPC Key
United States Army
Also to add for future refference.
As far as I know if you are feeding a variable into a command, you need to initlize the variable first prior to the command.
BAD EXAMPLE:
wscript.echo strText
strText = "What I want to echo!"
RESULT WILL BE: "" < A blank echo box.
GOOD EXAMPLE:
strText =...
.../NP /M /LOG+:Backup.txt" ' backup switches for Robocopy, including the /m switch to only copy new/modified files
'Asks to start the backup ******************************************************************************
X=MsgBox(" Good Afternoon todays date is " & Date & " **** Are you...
Good pointa.
You are both right, I could use an array to fill in the computer names (a self contained list); however, I think option two would be more efficient as it will require less typing.
Thanks for the input guys...really appericate it.
V/r,
SPC Key
United States Army
OK, so I tested the code on my own system. I have user level access rights (when not in admin mode) and the code worked like a charm - no error.
So...
I looked up the error code by going to Google and typing in the error number. The error number seems to be related to permissions.
Maybe try...
Here would be my way of querying AD for computer names...What is your way?
OPTION EXPLICIT
DIM objOU, objComputer, objRootDSE, objLastLogon
DIM strContainer, strDNSDomain
DIM intLastLogonTime, intGuyTime
strContainer = "OU=COMPUTERS,"
SET objRootDSE = GetObject("LDAP://RootDSE")...
So, thinking out loud here. I want to know if there is a way to contain a list within a script running.
For example, I have a script that changes an admin password on all systems in my OU based on a list of computer names. The VBScript changes the password on each machine grabing the machine...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.