Help to create a script

Hello all,

Someone could help me to create a script (vbs) that get the ip from the machine, then read the columm “J” of the CSV bellow, after finding the IP get’s the info on the columm “G” and write a key on the registry.

we did something similar, but using a position method as shown bellow:

On Error Resume Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set objWshShell = CreateObject("wscript.Shell")
strHostName = LCase(WshNetwork.Computername)
Set objFile = objFSO.OpenTextFile("\\server\test12\Scripts\teste\file.CSV", 1)
strCVS = LCase(objFile.ReadAll())
Call objFile.Close()
If InStr(strCVS,strHostName) = 0 Then
    WScript.Quit 1
End If 
strLinkSpeed = Mid(strCVS,InStr(strCVS,strHostName)+23,7)
strLinkSpeed = Left(strLinkSpeed,InStr(LCase(strLinkSpeed),"k"))
'MsgBox strLinkSpeed
Call objWshShell.RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\LinkSpeed\LinkSpeed ",strLinkSpeed)

From here: Computer Group creation based on data from a CSV file

There are a few different options for getting the IP address of the client system using relevance:

registration address of client

Or: (this one can have multiple results)

addresses of adapters of networks

This relevance will give the line of the CSV file that contains the IP address of the client:

lines whose( exists (it as trimmed string) whose(it is contained by set of (it as string) of addresses of adapters of networks) of following text of last "," of it ) of files "file.csv"

Assuming all entries in the CSV file are separated by exactly a comma followed by a space, then this will work to get column G:

unique values of (it as trimmed string) of tuple string items 6 of lines whose( exists (it as trimmed string) whose(it is contained by set of (it as string) of addresses of adapters of networks) of following text of last "," of it ) of files "file.csv"

Otherwise this should work to get column G:

( unique values of (it as trimmed string) of tuple string items 6 of concatenations ", " of substrings separated by "," of it ) of lines whose( exists (it as trimmed string) whose(it is contained by set of (it as string) of addresses of adapters of networks) of following text of last "," of it ) of files "file.csv"

In actionscript, you could do the following:

prefetch file.csv ??????????????????????????????

parameter "LinkSpeed" = "{ ( unique values of (it as trimmed string) of tuple string items 6 of concatenations ", " of substrings separated by "," of it ) of lines whose( exists (it as trimmed string) whose(it is contained by set of (it as string) of registration address of client ) of following text of last "," of it ) of download file "file.csv" }"

setting "LinkSpeed"="{ parameter "LinkSpeed" }" on "{parameter "action issue date" of action}" for client

This would work on Windows, Mac, Linux, Unix, etc…

You could use a regedit command instead of using a client setting, but then it wouldn’t be cross platform. Client settings are readable easily in BigFix to create automatic groups, but they are also located in the registry on Windows, so they are available to other things that way.

I don’t recommend creating tons of client settings all over the place, but something like LinkSpeed seems like a good use for it.