Script to modify the location attribute in an existing subnet registered on AD sites

Could anyone help me to make an script to modify the location attribute in an existing subnet registered on AD sites and services.
Using the script to create subnet, like this one below, occurs error because the subnet already exist:
 Set objRootDSE = GetObject("LDAP://RootDSE")
  strConfigurationNC = objRootDSE.Get("configurationNamingContext")
  strSiteObjectDN = strSiteObjectRDN & ",cn=Sites," & strConfigurationNC
  strSubnetsContainer = "LDAP://cn=Subnets,cn=Sites," & strConfigurationNC
  '-- Create Subnet --
  Set objSubnetsContainer = GetObject(strSubnetsContainer)
  Set objSubnet = objSubnetsContainer.***MODIFY/UPDATE***("subnet", strSubnetRDN)
  objSubnet.Put "siteObject", strSiteObjectDN
  objSubnet.Put "description", strDescription
  objSubnet.Put "location", strLocation
  objSubnet.SetInfo
Thanks,

Just get the subnet by name:
subnet = "192.168.1.0\/24"
Set objRootDSE = GetObject("LDAP://RootDSE")
strConfigurationNC = objRootDSE.Get("configurationNamingContext")
strSiteObjectDN = strSiteObjectRDN & ",cn=Sites," & strConfigurationNC
strSubnet = "LDAP://CN=" & subnet & ",cn=Subnets,cn=Sites," & strConfigurationNC
Set objSubnet = GetObject(strSubnet)
objSubnet.Put "description", strDescription
objSubnet.Put "location", strLocation
objSubnet.SetInfo
¯\_(ツ)_/¯

Similar Messages

  • Shell script to modify the xml attribute

    Hi All,
    I am new to shell script. I have to add one command in a shell script file to modify xml file.
    +*<oa:link id="iSupplier" adminCustomizable="true" destination="http://server1/" />*+
    I have to modify the destination attribute of above mentioned tag_ in a xml file. Anybody can suggest me how can we do this in shell script.
    Thanks in advance..
    Regards,
    Purushoth.

    Thanks for feedback. Compiling this product under Enterprise Linux 5 seems problematic. Binary package is available from the EPEL repository (Fedora)
    http://fedoraproject.org/wiki/EPEL
    su -c 'rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm'
    # yum install xmlstarlet
    Edited by: Dude on Nov 25, 2010 7:31 AM

  • Modify the Net price of an existing Sales Order

    Hi,
    I got a requirement to modify the Net price of an existing Sales Order. I have called BAPI  "BAPI_SALESORDER_CHANGE" for this purpose but its not working. I have passed the New Price in  CONDITIONS_IN table parameter. Can you help me with any BAPI or FM for this purpose.
    Mukesh KUmar
    Moderator message : Duplicate post locked.
    Edited by: Vinod Kumar on Dec 7, 2011 9:40 AM

    Talk to your SD consultants. Net value is determined based on the pricing conditions. Pricing configuration is usually unique to each business, so your SD consultant should know how the pricing condition should (and may) be changed in your specific situation.

  • In numbers 2 there was a "show search" which gave a list of all occurences of a value with the location. Does this exist in Numbers 3?

    in numbers 2 there was a "show search" which gave a list of all occurrences of a value with the location. Does this exist in Numbers 3?

    G.,
    The search results pane is gone in V3. If it's critical, stay in V2. I'm not being flippant, I have certain documents that I very carefully keep away from V3 because I don't want to give up the V2 features for those particular files. Some users have reported problems with having both versions active at the same time, so it's best to quit one before launching the other, but other than that you just need to be careful not to open your V2 documents with V3.
    Jerry

  • AD user script to populate the IPPHONE attribute with the last 4 digits of the Telephonenumber attribute

    Good Afternoon Scripting Guys. I have a script that I have been working with pretty much all day today and just cant quite get it to play nice. Our objective is to search AD for specific users (say filtering them out with a username that starts with a "T")
    and User account is "Enabled" then grab the last four digits of their phone number (phone number is set up as follows: (800) 123 456 ) then populate the IPPHONE attribute with the last four digits of their phone number. I have read a ton of online
    blogs with users successfully making this happen but it appears that they are all using Quest (as the commands are all Get-qaduser and Set-qaduser). I need something that runs strictly in native Active Directory Module PowerShell on a Windows Server 2008r2
    Domain Controller.  I am also trying to keep it as simple as possible by using a Get command, then piping a Set command.  I have saved the script into a .ps1 file with the logic as follows:
    $SelUsers = Get-ADUser -filter {(SamAccountName -like "t*")} -Properties ipphone,telephonenumber -searchbase "OU=Test Users,OU=Temporary Org,OU=Test_Domain Users,DC=mydomain,DC=com" | where {($_.enabled -eq $True)}
    foreach ($user in $SelUsers)
     {$user.ipphone = $user.telephonenumber(4,$User.telephonenumber.length-4)
     set-aduser -instance $user}
    What is happening is kind of funny, but aggravating at the same time.  When we run the script, it completes with no errors.  When I pull up the properties of a user in the OU, the IP Phone field is populated with the number 8.  If the User
    account did not have a telephone number, the IP Phone field is populated with a -4.  So, apparently, the script is somehow subtracting the "-4" from the number of all of the Telephone Number field's characters.  Basically 12-4 is 8. 
    If there is no telephone number, then 0-4 is -4.  I have run the Get-ADUser portion of the script independently so I know its getting the correct users.  I also know it is populating the IPPHONE attribute but not with the last 4 digits of the telephone
    number.  Can you guys help out and maybe get this to work correctly?  Also, can you add logic to it to the script to delete any value in the IPPHONE field first, then replace it with the last 4 digits of the telephone.
    Any help would be GREATLY appreciated!!!!!  Thanks Guys...
    Lee

    First thing I would do is modify your filtering. This will remove the unneeded piping to the Where-Object cmdlet and also allow us to only return users who already have something in the telephoneNumber field. It is possible this could return all of your
    users, but if you have service accounts, etc. that do not have a telephoneNumber then they will not be included in your results. It's just a little cleaner.
    $SelUsers = Get-ADUser -filter {(SamAccountName -like 't*' -and Enabled -eq $True -and TelephoneNumber -like '*')}
    I suspect you may have a made a mistake when you entered what your phone numbers looks like. I assume that you forgot a final digit. If this is correct, and you have a space in the phone number between the three digits and the final four then you can use
    the split method to grab the last four digits.
    Foreach ($User in $SelUsers) {
    $Number = $User.telephoneNumber.split(' ')[-1]
    Set-ADUser -Identity $User -Replace @{ipPhone=$Number}
    There's no reason to delete what's in the field first because that's part of what the -Replace parameter will do anyway. This should help get you started!

  • Matching HR and AD records on 2 attributes, then modify the join attribute?

    Hi,
    We are introducing FIM into an environment consisting of an HR system and AD, with no so happy data. I know that data integrity is key, but there are people above that want some results....so....
    The only match between the existing HR and AD data we can find is the 'firstname' & 'surname' attributes. Lets assume for now that there are no duplicate 'firstname' & 'surname' attributes in HR and AD...could we join the records on 2 attributes
    of 'firstname' & 'surname'?
    Once the records are joined, we would then flow the 'employeeID' attribute from HR to AD.
    Could we then remove the 'firstname' & 'surname' join rule and replace it with 'employeeID' attribute join rule?
    Thank you,
    SK

    Yes, or even leave the name-based join there but lower in precedence than the employeeID one. In practice the problem with name-based joins is not just the obvious one of duplicates but more often that the entry in AD has been created with a preferred
    first name (e.g. Dave) whereas the HR one has the legal first name (e.g. David), leading to missed joins.

  • Modify the email contents when adding a colleague in SharePoint My site

    Hi I want to modify the mail that is sent to the person I add as a colleague in mysite.
    I want to modify the mail content.
    Regards
    Vinod

    Hi,
    According to your post, my understanding is that you wanted to modify the email content for adding colleagues alert.
    After some search and research, I have found that It is not
    supported way of modifying text/format of email that goes out when a colleague is added.
    The text/format is hard coded in a private method (Microsoft.Office.Server.UserProfiles.ColleagueManager class) in an assembly that ships with SharePoint.
    For the normal list, we can modify the content by edit the XML file of
    alerttemplates.xml. We can find it in the below path.
    C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\XML
    http://sharepoint.stackexchange.com/questions/26172/can-the-added-as-colleague-email-text-format-be-changed
    Thanks,
    Jason
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Jason Guo
    TechNet Community Support

  • Modifying the size of an SMB 3.0 registered file share in SCVMM 2012 SP1

    Hi -
    We are leveraging the Netapp SMI-S 5.0 provider with SCVMM 2012 SP1 to register and use SMB 3.0 file shares on our HV clusters.  Working great after a few early problems.  One thing that we've yet to find is a solution to this problem.
    On the netapp side, let's say a volume with size 1TB is created.  Then through SCVMM/SMI-S, a new file share is created within this volume for use with HV clusters/VMs.  Let's say, for example when creating this share through the SCVMM GUI that
    you define the file share size as 500gb.  This leaves 500gb free in the parent volume.
    How in the world do you modify that file share size from the SCVMM perspective - if you start running low on space within the share.  The free space is definitely there, but we can't seem to find a way from within SCVMM to modify the file share 'size'
    (which is a parameter you have to define during file share creation) from original size to something larger (yet still smaller than parent volume size).
    Anyone else seen this scenario and/or found a solution?  I apologize if this is already answered elsewhere - just not seeing much on searches.  Thanks in advance -

    Ok so we just ran into a similar issue with our netapp. And after digging around my colleagues and I found this document ( https://communities.netapp.com/community/netapp-blogs/msenviro/blog/2014/02/19/data-ontap-smi-s-agent-51--use-netapp-smi-s-provider-to-provision-a-cifs-share-for-smb-30-environments-windows-server-2012-using-scvmm-2012-r2
    ) had a key passage: "SMIS create/manage shares created on qtree with quota assigned to it."
    So taking that the SMI-S agent uses quotas on the volume to determine the 'file share' size you can adjust the space available to Hyper-V by adjusting the quota on the volume, even increasing it to beyond the space available in the volume. We are actually
    doing this because of dedupe savings on our hyper-v store.
    IMPORTANT - the SMI-S agent only scans every 5 minutes, so when you make a quota change it may take up to 5 minutes for it to be detected... so wait
    6 minutes and then refresh the storage provider.  We were working with SCVMM 2012 R2 but this should be reflected with SCVMM 2012 SP1 if im not mistaken.

  • Is it possible in firefox to close a browser window/tab using java script without modifying the configuration settings? If YES, please let me know.

    Requirement: On click of button, I want the browser window to be closed.
    Solution: I am calling below java script on "onClick()" event of button.
    function close_window()
    window.close()
    This works in internet explorer but not in Mozilla Firefox. What is the reason behind it. Is there any way out to close the browser window in Mozilla Firefox?

    Can you post a link to a page that opens a pop-up window where a close button doesn't work?
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
    *Do not click the Reset button on the Safe mode start window or otherwise make changes.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • Can we update the Category attribute values of a file

    Can we update the Category attibute values of a file with out checkout the file?
    I have set the version configuration to folder and try to update the category attribute values of a file under that folder,
    It is asking to checkout the file before modifying the category attibute values.
    Is it required to checkout the file before modifying the category attribute values of that file?
    Is there any way to update the category attribute values without checkout the file?
    Please help on this

    One of the ways i can think of is using Batch Loader script for large number of files. Mention such files in Batch Loader script, and it will update category and all meta-data required in terms of next revision.
    In case number of files are less manual checkout and check-in will help.

  • Modify Active Directory attributes

    I have a strange query here -
    I am working with a small base of active directory users. Their account properties in active directory has all the information like phone, email, webpage etc. Only recently all of the users migrated to Gmail which means that their username remains same for
    ex. firstname.lastname but their email part changed to Gmail.com.
    So earlier it was [email protected] & now it
    [email protected]
    Is there a way I can change just the domain part of their email through Powershell? In otherwords, can I change AD attribute, in this case email without going through them manually.
    Thanks in advance.

    Assuming you need to modify the mail attribute, this PowerShell V1 script should work. However, I have not tested this:
    $Searcher
    = New-Object System.DirectoryServices.DirectorySearcher
    $Searcher.SearchRoot
    = "LDAP://dc=MyDomain,dc=com"
    $Searcher.PageSize
    = 200
    $Searcher.SearchScope
    = "subtree"
    # Retrieve all objects with an email address using @xyz.com.
    $Searcher.Filter =
    "(mail=*xyz.com)"
    $Searcher.PropertiesToLoad.Add("distinguishedName") >
    $Null
    $Searcher.PropertiesToLoad.Add("mail") >
    $Null
    $Results =
    $Searcher.FindAll()
    ForEach ($Result
    In $Results)
        $DN
    = $Result.Properties.Item("distinguishedName")[0]
        $Email
    = $Result.Properties.Item("mail")[0]
        # Modify email address.
        $Email
    = $Email.Replace("@xyz.com",
    "gmail.com")
        # Bind to the user object.
        $User
    = [ADSI]"LDAP://$DN"
        # Assign new value.
        $User.mail
    = $Email.ToString()
        $User.SetInfo()
    Richard Mueller - MVP Directory Services
    Richard, 
    I need a script which is almost identical to this in Powershell V2 format... are you able to help?

  • HT5467 How to change the location service set up when the icon is not inactive?

    I can not setting up the location services and change individual location service for each application since the icon are all in the dead icon and I cannot change anything. Is there anyway to make those icons in active?

    Here is what I was referring to - when in Control Center, I have the database locations. (sources, targets, OWF etc). Under a database location I selected the connector/location name under Connectors. When I select Deploy Action to Drop the connector/location name will remain. However, if you were to check in the database or the Repository Browser (Locations Report) you will see that the db link is gone. At this point you can safely modify the Locations info in the Connection Explorer (in Design Center). On the other hand, if you want the location to be deleted all together then now you can delete it in the Connection Explorer panel. If you did the prior drop step then at this point all db link info should be gone from the database.

  • How to change the location value after it is registered

    hello,
    I want to change the location (A) to a new schema. From what I am understanding, I need to unregister the old locatin(A) in repository browser, and then re-register it in control center, and change the schema name to my new target.
    Now, I have unregisted A in the repository browser. When I come back to control center, and click the register, everything is grey out which means I cannot change the value (but i need to change the value for service name and schema), except the password value. and on the top, it says 'this location has not been registered. please complete the location parameters'.But I know on the old version, like owb 9.0.5, the grey out means this location is registered. So I am really comfused now. The location is unregisted, why cant I change the value of this location?
    any suggestion will be appreciated.

    Here is what I was referring to - when in Control Center, I have the database locations. (sources, targets, OWF etc). Under a database location I selected the connector/location name under Connectors. When I select Deploy Action to Drop the connector/location name will remain. However, if you were to check in the database or the Repository Browser (Locations Report) you will see that the db link is gone. At this point you can safely modify the Locations info in the Connection Explorer (in Design Center). On the other hand, if you want the location to be deleted all together then now you can delete it in the Connection Explorer panel. If you did the prior drop step then at this point all db link info should be gone from the database.

  • How to change the location of a column in a Oracle table?

    Sir:
    I want to add a new column in a table, but I dont want to add the column at the last of the table, how can I do it ? If I want to modify the locations of columns in a table, How can do it?
    Thanks

    You can't modify the order of columns in a table, though there shouldn't be any particular reason to care about the order of columns.
    You can always create a view over the table that SELECT's the columns in the order you want, though.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • How to get the location of the JMenuItem on the screen in actionPerformed

    How can I get the location of the JMenuItem on the screen in actionPerformed.
    When I use the function getLocationOnScreen() on JMenuItem or the object retruned by getComponent() I get IllegalComponentStateException.
    I have figured out that inside actionPerformed the parent of the JMenuItem which is JPopupMenu (that contains the JMenuItem) is not visible anymore (its isVisble() function returns false).
    Then how can I get the location on the screen of the JMenuItem or it�s popup menu such that I can use it in subsequent call to SwingUtilities.convertPoint(JMenuItem, int x, int y,frame), as I need to display a modal dialog box relative to the position of the popup menu in it�s frame.
    Regards,
    Janusz

    Thanks for reply.
    Unfortunately I have to figure out the location of the menu from within actionPerformed handler. At that point of time it is too late to overwrite JMenuItem. I probably could do some severe surgery in the code to implement my own JMenuItem derived class & overwrite processMouseEvent and pass the location attribute somehow to actionPerformed handler � but I am looking for some solution that would not require changes to the code outside actionPerformed handler.

Maybe you are looking for

  • Follow-Up Transaction in WebClient UI

    Hello, I want to create a follow-document in Web UI. Copy Control works in SAP GUI but when I press the button for Follow-Up in Web UI no transaction types are displayed in the PopUp. Any idea of how to solve this? Best Regards JM

  • Front end for servlets like VB

    Hello, I am searching for the forntend which helps me while writting servlets like giving online help with all the properties,methods, and syntax. One guy wrote me to download this software for my requirement. So I downloaded this file "NetBeansIDE-r

  • Will Mountain Lion Run on a Solid State Drive?

    Will Mountain Lion Run on a Solid State Drive?

  • Toshi SD-R5372 - doesn't recog CD R/Ws

    This post contains a very detailed description of my troubleshooting steps and admittedly is a little long. I wanted to be thorough so apologies right up front, OK? Also, I can't find a forum for North America! Here's an interesting situation. Have a

  • How to block manual PR

    Dear All, We are using plant level MRP and in MRP all requirement will generate like PR& Planned order but users are creating manual PR .Now my question is how to block manual PR even though  MRP PR exist in the system for particular material. Thanks