Creating Subdomain DNS Entries using Powershell

Hello There,
I created a Powershell script to add some SRV records on a AD-Integrated Zone that Works fine.
The problem is, I created some subdomains (Right-Clicking on the DNS zone and then adding a new Domain) and I cannot create the records on these subdomains using the shell.
My Script is this one:
Import-CSV TEST.CSV | ForEach-Object -Process {Add-DnsServerResourceRecord -ZoneName ccr.intranet -A -DomainName $_.Hostname -Ipv4Address $_.IP}
It´s working really fine. But, when I try to reference the zone as subdomain.ccr.intranet (example), I cannot create the record, because it tells me that the subdomain is not actually a zone.
Is there any ways to create these records using the Powershell Script? I have more than 300 srv records and, even I need to create then manually, I really doubt that this is the Only way to do that.
Thanks!

... I'm a little confused, sorry.  So, you want to create an SRV record in ipaosb.ccr.intranet such as _sip._tcp.ipaosb.ccr.intranet, but when you specify the zone as ipaosb.ccr.intranet, it tells you no such zone.
What happens if you try this?
Add-DnsServerResourceRecord -Srv -ZoneName ccr.intranet -Name _sip._tcp.ipaosb -DomainName as2metrobah.ccr.intranet -Port 5060 -Priority 0 -Weight 0
Where _sip._tcp.ipaosb would be replaced by $_.hostname, and reflected in the CSV?
Please remember, if you see a post that helped you please click "Vote As Helpful" and if it answered your question please click "Mark As Answer".
SWC Unified Communications

Similar Messages

  • Creating a Scheduled Task using PowerShell v4

    So here is my question.  I'm trying/wanting to create a scheduled task using PowerShell v4 on Server 2012R2.  I want to task to run on the 1st day of every month.  The parameter for -Monthly -Day is not available.  I need to use PowerShell
    to create the Scheduled Task because the Task will be running with a group Managed Service Account credentials so the Scheduled Task can not be created via the Task Scheduler GUI.
    Thanks in Advance

    Here is a functioning task It can be easily edited in PowerShell or in notepad to alter the timing
    <?xml version="1.0" encoding="UTF-16"?>
    <Task version="1.1" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
    <RegistrationInfo>
    <Author>W8TEST\user01</Author>
    </RegistrationInfo>
    <Triggers>
    <CalendarTrigger>
    <StartBoundary>2014-06-04T21:31:32.0459499</StartBoundary>
    <Enabled>true</Enabled>
    <ScheduleByMonth>
    <DaysOfMonth>
    <Day>1</Day>
    <Day>12</Day>
    <Day>24</Day>
    </DaysOfMonth>
    <Months>
    <January />
    <February />
    <March />
    <April />
    <May />
    <June />
    <July />
    <August /
    <September />
    <October />
    <November />
    <December />
    </Months>
    </ScheduleByMonth>
    </CalendarTrigger>
    </Triggers>
    <Principals>
    <Principal id="Author">
    <RunLevel>LeastPrivilege</RunLevel>
    <UserId>W8TEST\jvierra</UserId>
    <LogonType>InteractiveToken</LogonType>
    </Principal>
    </Principals>
    <Settings>
    <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
    <IdleSettings>
    <StopOnIdleEnd>true</StopOnIdleEnd>
    <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <Enabled>true</Enabled>
    <Hidden>false</Hidden>
    <RunOnlyIfIdle>false</RunOnlyIfIdle>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>P3D</ExecutionTimeLimit>
    <Priority>7</Priority>
    </Settings>
    <Actions Context="Author">
    <Exec>
    <Command>notepad.exe</Command>
    <Arguments>test.txt</Arguments>
    <WorkingDirectory>c:\temp</WorkingDirectory>
    </Exec>
    </Actions>
    </Task>
    I have edited and reloaded the XML many, many times.  It works very nicely.
    ¯\_(ツ)_/¯

  • Creating user in AD using powershell

    Hi,
    How to create ad user in opalis using powershell?

    Hi,
    best will be, you take the "Run .Net Activity" and put your PowerShell Script in there.
    Example Script
    new-aduser $LoginName -GivenName $FirstNameField -Surname $LastnameField -DisplayName $Displayname -UserPrincipalName "$[email protected]" -ChangePasswordAtLogon $true -AccountPassword (ConvertTo-SecureString –AsPlainText “password1password_1” -Force) -Path "OU=$OU,OU=User,OU=Company,DC=domain,DC=com" -Company $Company -Department $Department -enabled $true -EmployeeNumber $EmployeeNumber -Description $EmployeeNumber -EmailAddress $SMTPAdresse -Division $Division
    Seidl Michael | http://www.techguy.at |
    twitter.com/techguyat | facebook.com/techguyat

  • Creating Windows Basic Task using powershell

    Hello Everyone,
    Please help me out in the below situation:
    I have to create a basic windows task using powershell to run a script on a specific date and time.
    Let me make it even clear :
    I have a csv say,
    D:\xyz.csv
    ServerName ,  Date  , Time
    Random1,   11/15/2014,01:00:00PM
    Random2,   12/01/2015,03:00:00PM
    ...and so on
    I also have a script at E:\TestingServer.ps1
    I need to create list of windows tasks to invoke TestingServer.ps1 with parameters as servername and Time of task as given date and time in csv.
    Task1- with input as ServerName at Date and time from CSV
    Task2-with input as ServerName at Date and time from CSV

    Well here is a good article showing howto do this:
    http://blogs.technet.com/b/heyscriptingguy/archive/2012/09/18/create-a-powershell-scheduled-job.aspx
    ¯\_(ツ)_/¯

  • How to create a context menu using powershell

    Hi 
    i would like to create a context menu for powershell but i am getting an error after powershell menu is created
    "This file does not have a program associated to it. i am using this script . I am trying to create a powershell shortcut on folders."
    also once it gets created i would like to open powershell as admin always
    New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
    Test-Path HKCR:\Directory\shell\Powershell
    New-Item -Path HKCR:\Directory\shell -Name Powershell
    Set-Item -Path HKCR:\Directory\shell\Powershell -Value "Open Powershell Here" 
    New-Item -Path HKCR:\Directory\shell\Powershell\key -Value "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -NoExit -Command ""Set-Location -LiteralPath '%L'"""

    You need to put forth the effort to ask a good, clear, and meaningful question.
    As it stands, you seem to have a record of asking nearly unintelligible questions that take a great amount of effort for others to guess what you are asking. This is bad because it wastes everyone's time.
    Read these for some good information on how to ask good questions:
    Posting guidelines
    Handy tips for posting to this forum
    How to ask questions in a technical forum
    Rubber duck problem solving
    How to write a bad forum post
    -- Bill Stewart [Bill_Stewart]

  • Create Offline Address Book using powershell - PublicFolderDistributionEnabled not found

    We are using the following commands to create a new Offline Address book using powershell. The command New-OfflineAddressBook runs successfully and creates an Offline Address Book. However when we try to set the value of PublicFolderDistributionEnabled property
    using Set-OfflineAddressBook we get the following exception
    Remote Exception: A parameter cannot be found that matches parameter name 'PublicFolderDistributionEnabled'
                try
                    using (Runspace runSpace = OpenRunspace())
                        // Create offline address book command
                        var command = new Command("New-OfflineAddressBook");
                        command.Parameters.Add("Name", name);
                        command.Parameters.Add("AddressLists", addressListName);
                        command.Parameters.Add("VirtualDirectories", OABServer);
                        // Execute command
                        if ((res = ExecuteShellCommand(runSpace, command)) == false)
                            return false;
                        // Set offline address book command
                        var command1 = new Command("Set-OfflineAddressBook");
                        command1.Parameters.Add("Identity", name);
                        command1.Parameters.Add("PublicFolderDistributionEnabled", publicFolderEnabled);
                        command1.Parameters.Add("Confirm", new SwitchParameter(false));
                        // Execute command
                        if ((res = ExecuteShellCommand(runSpace, command1)) == false)
                            DeleteOfflineAddressBook(name);
                            return false;
                catch (Exception ex)
                    DeleteOfflineAddressBook(name);
                    throw;

    If your Exchange version is 2013 it supports only the web distribution method.
    Please follow this to create OAB in Exchange2013 
    http://blogs.technet.com/b/exchange/archive/2013/01/14/managing-oab-in-exchange-server-2013.aspx
    Please check this for the details of OAB in Exchange2013
    http://blogs.technet.com/b/exchange/archive/2012/10/26/oab-in-exchange-server-2013.aspx
    If it Exchange2010 please check
    this
    Thanks, MAS
    Please mark as helpful if you find my comment helpful or as an answer if it does answer your question. That will encourage me - and others - to take time out to help you.

  • Creating look up column using powershell.

    I have a Sharepoint list "Studentparent" in my website. I am trying to create a custom list "studentchild" list using powershell code and this studentchild list will be having a look up column getting ID column from "StudentParent"
    list - So the code is 
    #To which site u want to create the list 
    $spWeb=Get-SPWeb -Identity http://XYZ
    #List type or template 
    $spTemplate = $spWeb.ListTemplates["Custom List"]
    #Get all the lists to the listcollection
    $spListCollection=$spWeb.Lists
    #adding the new list to the list collection
    $spListCollection.Add("StudentChild","StudentChild",$spTemplate)
    #get the path of subsite and sitecollecion 
    $path = $spWeb.url.trim()
    #get the list to the list object
    $spList = $spWeb.GetList("$path/Lists/StudentChild")
    $ParentList = $spWeb.Lists.item("StudentParent")
    $spList = $WebObj.Lists["StudentChild"]
    $spList.Fields.AddLookup("ChildLookupField",$ParentList.id,$false)
    $spChildListLookupField = $spList.Fields["ChildLookupField"]
    $spChildListLookupField.LookupField = $ParentList.Fields["ID"]
    $spChildListLookupField.RelationshipDeleteBehavior = [Microsoft.SharePoint.SPRelationshipDeleteBehavior]::Restrict
    $spChildListLookupField.Update()
    $Views = $spList.Views["All Items"]
    $Views.ViewFields.Add("ChildLookupField")
    $Views.Update()
    but when i run this code - I am getting error
    Cannot index into a null array.
    + $spList = $WebObj.Lists["StudentChild"]

    Hi Mahesh,
    The object "$WebObj" is not instantiated in your code. You have already assigned the value to $splist in following line.
    $spList = $spWeb.GetList("$path/Lists/StudentChild")
    and once again you are assigning value
    $spList = $WebObj.Lists["StudentChild"] // redundant and it should be $spWeb.Lists["StudentChild"]
    Please let us know if this fixes your issue.
    Thanks,
    M. Gubendra Raj

  • Error creating groups in SCSM using PowerShell

    Hello Everyone,
    I am trying to create a bunch of groups and queues within SCSM to seperate work items and CIs from different customers. For example, I have started off by entering the console and creating a group called "Company 1" in my groups (found in Library).
    "Company 1" group defines dynamic members of this group by specifying the following query: The "Active Directory" class, if the Users Company field contains value "Company 1" then add to the group.
    I also need to create a Queue containing all work items for "Company 1".
    I can generate a list of all the company's to enter in a csv, and know enough powershell to import it and read the file line by line
    However, I am having trouble creating the objects. My method was:
    #Get the name of the class I want to create an object of and store it in a variable
    $groupClass = Get-SCSMClass -Name "Microsoft.SystemCenter.ConfigItemGroup$"
    #Return the variable stored to ensure this part is working (Debug purposes)
    $groupClass
    #Get the active status of an object and store it in a variable
    $objStatus = Get-SCSMEnumeration -Name System.ConfigItem.ObjectStatusEnum.Active
    #Return the variable stored to ensure this part is working (Debug purposes)
    $objStatus
    #Create the object stored in my class variable and modify the DisplayName and ObjectStatus properties.
    New-SCSMObject -Class $groupClass -PropertyHashtable (@{DisplayName = "Test"; ObjectStatus = $objStatus;}) -Debug -Verbose
    Once I got this code working my idea was to read from csv and loop the creation process. However, I keep getting the error: "Cannot create objects of an abstract class"
    Am I using the incorrect class to create a group? If so, what is the correct class to select? Is there a more efficient method to do this? Any ideas at all please share, thank you in advance :)

    @Aaron
    Sorry for the late response, I went on vacation and just returned. So basically, I ended up making all these groups manually since I could not find a way to automate the discovery rule creation through script.
    I am now trying to create queues for each of these clients, one queue for each type of work item. I'm working with a client list of around 100, so that means creating almost 300 queues. This would be crazy to do manually - So I began working on a script
    to do this.
    This is what I have come up with:
    # Script Written by SirLearnAlot
    # January 2015
    # Revision 2
    # Get required queues categories (classes)
    $incident = Get-SCSMClass -Name "System.WorkItem.Incident$"
    $RMA = Get-SCSMClass -Name "COMPANY.RMA.Class$"
    $MACD = Get-SCSMClass -Name "System.WorkItem.ServiceRequest$"
    # ManagementPack to store queues in (MP Must be created through PS or else will throw error)
    $MP = Get-SCManagementPack -Name "COMPANY.Queues"
    # Import list of customers (names for the queues)
    $content = Get-Content 'C:\Users\portalservice\Desktop\list.txt'
    foreach ($customer in $content){
    New-SCQueue -Verbose -Name "Incident - $customer" -class $incident -ManagementPack $MP -Filter "Customer_List -eq '$customer'";
    New-SCQueue -Verbose -Name "RMA - $customer" -class $RMA -ManagementPack $MP -Filter "Customer_List -eq '$customer'";
    New-SCQueue -Verbose -Name "MACD - $customer" -class $MACD -ManagementPack $MP -Filter "Customer -eq '$customer'"}
    However I kept running into errors.
    I realized I needed to point the Customer_List found in the incident class to the other two classes, so I had to re-author them to add the customer field and point towards the incident MP to retrieve the enum. I did this successfully with Service Requests,
    but am having trouble applying the same concept to my "RMA" class.
    I have tested the code with both Incidents and Service Requests now and can successfully create the queues correctly, but need to fix my RMA class to complete the task.
    I now cannot seal my MP because I keep running into errors (I am sure I made a typo somewhere or am missing some line or something)
    Any help would be appreciated I am getting extremely frustrated!

  • How to create RAS phonebook entry using cmd or win API

    I could't find forum about Batch/cmd or API so I'll post here. Hope it's ok, it's C# related after all.
    I need to implement simple VPN client functionality in my C# application, and it is highly preferable not to use any third party libraries, like DotRas for example, which I find not efficient and well documented anyway. I can use DotRas, but the connection
    fails 9 of 10 times, because of some keys DotRas don't set correctly. I can connect using:
    rasdail entryname user pass /PHONEBOOK:mypath
    The problem is how to create an entry (the custom phone book here is nod needed and it don't concern my question, I can use the default as well), I even know what keys to use, so I can create it from string, but the problem is in those 4 keys:
    LowDateTime= HighDateTime= DialParamsUID= Guid=
    I vaguely know what're those for, but I can't find good explanation how they are created. Windows documentation says:
    LowDateTime= - This key is optional and if present MUST be ignored by RRAS HighDateTime=30428537 - This key is optional and if present MUST be ignored by RRAS DialParamsUID=2945250 - This key specifies
    a unique identifier (an 8-bit ASCII-encoded string representation of a decimal number) to be used on RRAS for use as a credential key for demand-dial connection. This key is optional. Guid= - This key specifies a unique identifier (GUID) for this RRAS entry.
    This key is optional.
    Those are all optional and even omitted according to Microsoft documentation, but when I change one of those the connection fails with error 800, which I don't have an idea why. I can obviously create the entry with DotRas and change some keys, assuming the
    problem is not in those flags, and I'm not so sure in this, or I can try to automate and hide the vpn creation GUI in windows, but both the ideas look very ugly to me...

    Hi Memeandme,
    Thank you for visiting the MSDN forum.
    I’m afraid that it is not the correct forum about this issue, since this forum is to discuss Visual C# programming language. In .Net Framework, there is no build-in method to help you implement
    this.  Now I am moving your question to the moderator forum ("Where is the forum for..?"). The owner of the forum will direct you to a right forum. Thanks for your understanding.
    Best regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • List DNS entries using command line

    Can I use the command line to list out all my entries in DNS. If so can someone please point me in the direction of a site that shows me how to do this.
    TIA

    Are you running the DNS server yourself, or are you trying to extract all the data from a remote server?
    If you're running it yourself the simplest solution would be to just cat the zone file. Look in the /var/named directory for your zone file and just read it directly. For example, if your zone was 'mydomain.com' you should see a 'mydomain.com.' file in that directory, so you can just:
    cat /var/named/mydomain.com.
    If you're trying to query a remote server you'll have a harder time - most sites prevent an arbitrary dump of the entire zone file, responding only to individual queries.

  • Set Primary DNS Suffix Using Powershell

    For a Windows Server 2012 installation, what Powershell cmdlet can be used to change the Primary DNS Suffix ? I've tried using 'Set-DnsClientGlobalSetting -SuffixSearchList contoso.com' but this only alters the DNS Suffix Search List, not the primary DNS
    suffix.

    You might want to take you question to one of two forums that specialist in scripting issues.
    For PowerShell specific questions -
    http://social.technet.microsoft.com/Forums/en-US/home?forum=winserverpowershell
    For general scripting questions -
    http://social.technet.microsoft.com/Forums/en-US/home?forum=ITCG
    They have a lot of really sharp scripting people in those forums.
    .:|:.:|:. tim

  • Best way to Create Shared Folder using Powershell

    Hi
    Does anyone have any recommendations on creating a shared folder using PowerShell? I've used new-item to create a folder, is there a way to share it and give specific name?
    Cheers

    Hi Shane,
    I’m writing to just check in to see if the suggestions
    were helpful. If you need further help, please feel free to reply this post directly so we will be notified to follow it up.
    If you have any feedback on our support, please click here.
    Best Regards
    Anna
    TechNet Community 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 Support, contact [email protected]

  • Creating subdomains in server 10.4

    I am having some issues trying to creat a subdomain for my website. I am trying to create test.projectheaven.org. I have searched the dissussions and have only found this listing...http://discussions.apple.com/thread.jspa?messageID=1370284&#1370284
    I have tried to create another DNS entry just like the main one but when I change the nameserver to test, to converts the original www entry or zone to test rather then creating a new one.
    Any help would greatly be apperciated.
    Thanks

    It's not clear to me what you're trying to achieve, nor what you've done so far that doesn't appear to be working.
    For one, 'test.projectheaven.org' is not a subdomain, it's just another host in the projectheaven.org domain.
    If you want a subdomain you need to create a new zone file for test.projectheaven.org and add a new NS record to your projectheaven.org zone file that points test back to this server.
    It isn't clear whether you've added 'test' as a zone (with a corresponding NS record), or as a host, or whether you even need to.
    Or, am I misreading this altogether and since this is posted in the web forum what you actually mean is that you want to create a second web site 'test.projectheaven.org', not a subdomain at all?
    If that's the case it needs to be added as an additional Site in Server Admin -> Web -> Settings -> Sites
    Without knowing how you currently have that set, it's hard to know what changes need to be made.

  • Creation of service entry using BAPI_ENTRYSHEET_CREATE

    Hi Experts,
    I have a requirement to create a service entry using BAPI with multiple account assignments. It can be distributed by quantity or percentage. Please give sample code.
    Thanks,
    Lalyn

    Hi,
        Please go through the function module BAPI_ENTRYSHEET_CREATE documentation and the documentation available in importing, exporting, tables on the right hand side with green buttons. Then you can able to know how to use this bapi.

  • Set default quota for farm using powershell

    Hello, 
    Looking for a powershell solution to creating a default quota template. So when new sites are created they default to that quota, or can be changed if needed. 
    Thanks, 
    Will 

    This article is for 2010, but it should work the same in 2013.  This PowerShell just creates the quota template.  You will need to pick the quota template when creating a site collection.  There is no way to set a default quota template for
    regular site collections.
    http://www.sharepointdiary.com/2013/08/create-sharepoint-quota-templates-using-powershell.html
    Paul Stork SharePoint Server MVP
    Principal Architect: Blue Chip Consulting Group
    Blog: http://dontpapanic.com/blog
    Twitter: Follow @pstork
    Please remember to mark your question as "answered" if this solves your problem.

Maybe you are looking for

  • How to set system time from Terminal while booted from 10.6.3 server install disk?

    I'm installing from a 10.6.3 server install disc onto a Mac Mini.  However, the battery on this Mac Mini is pretty much dead, forcing the system time back to 1/1/2001.  Through some research, this has created a problem in that I cannot move beyond th

  • Report Viewer - error when creating connections

    What are the requirements for creating connection to report viewer web part? I'd like to set the parameters with values from a list. After... Create a blank page Add report viewer web part Add list web part Create connections (in the list Web Part, C

  • Copy InlineGraphicElement as text

    Hello, I have a chat with the support of smiles: When I copy the contents to clipboard I get the following output: User1 19:59﷯Lorem ipsum ﷯ 19:59﷯Lorem ipsum ﷯ User2 19:59﷯Lorem ipsum ﷯ Is it possible to define alternative text for graphic element a

  • New Software Version 1.5??

    Today I plugged in my ipod, and a pop up came up saying i needed to update to the I think it said new version 1.5. I hit the update button in i tunes then it says that somthing is wrong with my firm ware and it cant be updated. Now when I plug my ipo

  • Role of SD Techno-Functional consultant.

    Hello all, Am an ABAPer with one and half years of experience and have an opportunity to learn SD. Can somebody tell me What exact role i will be performing as a technofunctional and does it make sence markewise(i mean does it add value to salary). P