Tahir Qureshi
asked on
Script Extension require update AD computer location base on sites subnet
I had this question after viewing Need a script to update the location of each computer to the location tab.
I am not a programmer. I would like someone modification to the above script so that it can meet my requirement
Instead of taking value(computerName, location) from a csv file. I would like to take location value from VLan (because each site has a specific VLan) and display the site name in AD location attribute so that I don't need to update csv file again and again.
Yes I would like to save the output file into csv at a specific location but I don't want any notification if script has exit code = 0.
lastly each computer should have only one entry in csv file. For example If someone login to the computer at New York than Dallas. the csv file should contain only one entry for Dallas (there should be no entry for New York)
once script is ready I will setup as a login script so that It will update automatically
I am not a programmer. I would like someone modification to the above script so that it can meet my requirement
Instead of taking value(computerName, location) from a csv file. I would like to take location value from VLan (because each site has a specific VLan) and display the site name in AD location attribute so that I don't need to update csv file again and again.
Yes I would like to save the output file into csv at a specific location but I don't want any notification if script has exit code = 0.
lastly each computer should have only one entry in csv file. For example If someone login to the computer at New York than Dallas. the csv file should contain only one entry for Dallas (there should be no entry for New York)
once script is ready I will setup as a login script so that It will update automatically
ASKER
I don't want to give value to script. it should be automatically. I want to use this script as a login script
I can get the the site through my script. i just want to store this value to location attribute
I can get the the site through my script. i just want to store this value to location attribute
Set objRootDSE = GetObject("LDAP://RootDSE")
strConfigurationNC = objRootDSE.Get("configurationNamingContext")
strSubnetsContainer = "LDAP://cn=Subnets,cn=Sites," & strConfigurationNC
Set objSubnetsContainer = GetObject(strSubnetsContainer)
objSubnetsContainer.Filter = Array("subnet")
Set objHash = CreateObject("Scripting.Dictionary")
For Each objSubnet In objSubnetsContainer
objSubnet.GetInfoEx Array("siteObject"), 0
strSiteObjectDN = objSubnet.Get("siteObject")
strSiteObjectName = Split(Split(strSiteObjectDN, ",")(0), "=")(1)
If objHash.Exists(strSiteObjectName) Then
objHash(strSiteObjectName) = objHash(strSiteObjectName) & "," & _
Split(objSubnet.Name, "=")(1)
Else
objHash.Add strSiteObjectName, Split(objSubnet.Name, "=")(1)
End If
Next
For Each strKey In objHash.Keys
WScript.Echo strKey & "," & objHash(strKey)
Next
Where are you getting the Vlan tag from?
I am not aware of any value within WMI or ipconfig that the Vlan is stored. Are
I would assume you have each Vlan on a 24 bit subnet and each one of your vlans ipaddress will have a different third octet. Is that correct?
I am not aware of any value within WMI or ipconfig that the Vlan is stored. Are
I would assume you have each Vlan on a 24 bit subnet and each one of your vlans ipaddress will have a different third octet. Is that correct?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great
Thanks Rob
Thanks Rob
Is this going to be dynamic or leverage the column and if the computer object is in Vlan1 the Location field will be populated with NYC?
does your CSV have the computer name as a column?
Do you have a copy of your CSV?
This is a basic idea that you can follow
Open in new window