Assign IP to newly created VM using powershell

Hi,
I have created a new VM in hyperv and added a fresh Windows server 2012 VHD.
Now I need to assign IP to the new VM using powershell.
Regards,
Suganya.

Hi Suganya,
you are indeed right and I messed up there (We use VMware so I couldn't give it a try. In that case I tend to browse the library but was too superficial).
That said, I did a more thorough research to make up for it, and
this blog entry discusses that very problem and has a powershell solution to it. Can't test it though, so you may want to run the wmi queries step by step against your Hyper-V.
Cheers,
Fred
There's no place like 127.0.0.1

Similar Messages

  • How can I assign an icon to a folder using Powershell?

    How can I assign an icon to a folder using Powershell?

    I'm trying to make a script that goes through a folder recursively, checks for every folder if it's name is "template", and if so it changes the icon of that folder to an icon
    I chose.
    I searched for an answer here, and I've only managed to find a way to assign an icon to a shortcut, but not to an existing file.
    Thanks in advance (:

  • Unable to open newly created files using a specific font.

    Hello everyone!
    All of a sudden, I am not able to open newly created files in Acrobat Pro 9.0 that use a specific font. It seems to be localized to files that are created in Microsoft Words, as I tried to create a document in Pages and was able to open that PDF (using the same font) in Acrobat. I'm not sure what to do at this point...Any ideas?

    Hi,
    If you have recently upgraded to Mac OS X 10.6.7, then have a look here:http://forums.adobe.com/message/3593533#3593533, where Steve Werner had the solution.
    Niall

  • Fail to create VM using PowerShell commands

    I tried to create a new VM with Public IP. The only way I found was using PowerShell.
    This was the commands I used.
    $vm = New-AzureVMConfig -Name "mu0035" -InstanceSize Small -ImageName "b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_1-LTS-amd64-server-20140924-en-us-30GB"| Add-AzureProvisioningConfig -Linux -LinuxUser $username -Password $password|Set-AzurePublicIP -PublicIPName "mu0035PIP"
    It returns `BadRequest: The location or affinity group East Asia of the storage account where the source image b39f27a8b8c64d52b05eac6a62ebad85 resides is not in the same location as the specified cloud service ,"Southeast Asia"`.
    It seems the image locate in East Asia, and I want to create VM in 'Southeast Asia'.
    Interest thing is, I have already set the subscription's currentstorageaccount to a `Southeast Asia` storage account. 
    Get-AzureSubscription -Current
    SubscriptionId : $subscription_id
    SubscriptionName : BizSpark
    Environment : AzureCloud
    SupportedModes : AzureServiceManagement,AzureResourceManager
    DefaultAccount : $account_name
    Accounts : {$account_name}
    IsDefault : True
    IsCurrent : True
    CurrentStorageAccountName : sourtheast
    Get-AzureStorageAccount -StorageAccountName sourtheast
    StorageAccountDescription :
    AffinityGroup :
    Location : Southeast Asia
    GeoReplicationEnabled : True
    GeoPrimaryLocation : Southeast Asia
    GeoSecondaryLocation : East Asia
    Label : sourtheast
    StorageAccountStatus : Created
    StatusOfPrimary : Available
    StatusOfSecondary : Available
    Endpoints : {https://sourtheast.blob.core.windows.net/, https://sourtheast.queue.core.windows.net/, https://sourtheast.table.core.windows.net/}
    AccountType : Standard_GRS
    StorageAccountName : sourtheast
    OperationDescription : Get-AzureStorageAccount
    OperationId : f1326e6e-951d-1c9c-bb4d-4a65900025bb
    OperationStatus : Succeeded
    I can't figure out what happened. Why the powershell command not fetching the image from a wrong location?
    Please, Help!

    Hi, it looks as though the "StorageAccountName" is set to "sourtheast", possibly just a typo when the accountname was created?

  • Import a dumpy file to newly created schema using the old schematablespace!

    I'd created an export dump file of user X with rows=n (for Replicating the schema data structures to another schema). When I import using this dump file to newly created user Y. The newly created objects(tables,indexes) are using the tablespaces that were used in X instead of the default tablespace of Y.
    How can I import X objects into Y with Y's default tablespace.?

    CJ and others,
    This just worked fine for me. here is what I did:
    sql> connect system/manager
    create tablespace tbs1 datafile tbs1.f size 10m;
    create tablespace tbs2 datafile tbs2.f size 10m;
    create user user1 indentified by user1 default tablespace tbs1;
    create user user2 indentified by user2 default tablespace tbs2;
    create table user1.tab1 (a number);
    insert into user1.tab1 values (100):
    commit;
    exit;
    $ exp user1/user1 file=user1.dmp
    sql> connect system/manager
    drop tablespace tbs1 including contents;
    exit
    imp system/manager file=user1.dmp fromuser=user1 touser=user2
    This imported user2.tab1 into tablespace tbs2. I think if tbs1 was still around, then it would have imported it into tbs1.
    Thanks
    Dean

  • EMail Notification for the Newly Created users using UME API

    Hi ,
    In my application ,the user creation is handled by custom Admin module which uses the UME APIs. Upon creating the user, we need to send a notification mail to the user's email id which he provided in the Add new user form.
    <b>Is there any direct APIs available to notify the user via email. I hope the Standard user creatin module in User Administration also uses the same UME APIs.</b>
    Please let me know the possibilities.
    Appreciate your help.
    <b><b>Sample Code:</b>
         <b>IUserFactory mUserFact = UMFactory.getUserFactory();
         IUserMaint mUserMaint = mUserMaint = mUserFact.newUser(aUser.getLogin());
         IUserAccountFactory mAccountFact =UMFactory.getUserAccountFactory();
         IUserAccount portalAccount = null;
         mUserMaint.setDisplayName(aUser.getLogin());
         mUserMaint.setXXX();
         mUserMaint.save();
         mUserMaint.commit();
         portalAccount = mAccountFact.newUserAccount(aUser.getLogin(), mUserMaint.getUniqueID());
         mAccount.setPassword("XXXXXX");
         aUser.setPassword(mPassword);
         mAccount.save();
         mAccount.commit();</b></b>
    Thanks and Regards,
    Sekar

    Hi,
    I have used the Java Mail API directly send the notification upon new user creation.
    Thanks and Regards,
    Sekar

  • Using PowerShell to add VBA to an Excel spreadsheet

    I have a PowerShell script that creates an Excel spreadsheet and is able to save it.  I also have VBA code that I would like to put into that newly created spreadsheet.
    Is there a way of adding the VBA code into my newly created spreadsheet using PowerShell? 
    Thanks,

    Thanks for the response Alex,
    Where I use to work, we would commonly do this with VBScript and Excel 2003.   Below is an example from the Scripting Repository using VBScript (Add a Macro
    to an Excel Spreadsheet)
    Set objExcel = CreateObject("Excel.Application")
    objExcel.Visible = True
    objExcel.DisplayAlerts = False
    Set objWorkbook = objExcel.Workbooks.Open("C:\scripts\test.xls")
    Set xlmodule = objworkbook.VBProject.VBComponents.Add(1)
    strCode = _
    "sub test()" & vbCr & _
    " msgbox ""Inside the macro"" " & vbCr & _
    "end sub"
    xlmodule.CodeModule.AddFromString strCode
    objWorkbook.SaveAs "c:\scripts\test.xls"
    objExcel.Quit
    We would use a variant of this method to generate static Excel reports from spreadsheets that were linked to external data sources.
    Now...  it's time for me to upgrade my code and get on the PowerShell boat :)  So I have been working on a script that does a similar thing, but there does not appear to be a method of adding a macro to an Excel spreadsheet using PowerShell.  There
    appears to be no way of calling VBProject.VBComponents.Add from within PowerShell.
    I have tried manipulating the data that resides within Excel by directly accessing it from PowerShell, but this has proven to be painfully slow.  What a macro can do in 3 seconds, takes PowerShell 8 hours to do :(
    If it can't be done... then I'll have to revert back to my old ways.  But if it can be done, great!!!  PowerShell has alot more to offer me than VBScript did.

  • How to know which row is newly created in the table

    Hi all
    i have one classic table with a button to add new row.
    when page renders initially it displays some record .Here user can either update the previously existing record or may create new ones .
    after adding one more row when users submits it , in back-end i need to go thru all the rows in the view to do some validations .but i need to insert newly created row using API. how can i know which row haas been newly created,
    pls help

    you can know which row is new using different techniques at different places, depending where you want to do it.
    1. In AMImpl: if the PK column attribute of the row does not have a value, then you know this is a new row.
    2. In EOImpl: insertRow will be executed only if it is a new row.
    3. In Pl/SLQ package (if being called from EOImpl): You can check the creation_date or OVN for the row and determine if this is a new row.
    4. You can use the method mentioned in this thread
    Row Status Question
    Thanks
    Tapash

  • Unable to move mailbox to newly created database in exchange 2013

    Hi, i created a new database in our existing exchange server 2013 sp1 and i was trying to move my mailbox to the newly created one using the EAC. But the mailbox is not getting moved and i am not receiving any errors. Is there anything else i need to do
    after creating the database.
    Please advise.

    Hello
    lets play again:
    new-moverequest -identity useremailaddress -targetdatabase new database
    after two minute get move req log
    get-moverequest -identity useremailaddress |get-moverequeststatistics -includereport |fl
    or if have got more DC specified one Dc with -domincontroller DCname
    sorry my english

  • How to assign project specific task with the newly created projects ?

    Hi All,
    I need help. I need to assign project specific tasks (which i will be taking from staging table) other than the default task which are assigned during project creation. How do I proceed with this within same package. I am attaching the code of my package below...
    CREATE OR REPLACE PACKAGE body xxpa_proj_conv_pkg as
    PROCEDURE xxpa_create_project_proc(O_ERRBUF OUT VARCHAR2,O_RETCODE OUT VARCHAR2)
    is
    variables need to derive global parameters
    v_responsibility_id NUMBER; --- PA Supervisor responsibility id
    v_user_id NUMBER;
    deriving global parameters-
    -- Variables needed for API standard parameters
    v_api_version_number NUMBER := 1.0;
    v_commit VARCHAR2(1) := 'F';
    v_return_status VARCHAR2(1);
    v_init_msg_list VARCHAR2(1) := 'F';
    v_msg_count NUMBER;
    v_msg_index_out NUMBER;
    v_msg_data VARCHAR2(2000);
    v_data VARCHAR2(2000);
    v_workflow_started VARCHAR2(1) := 'Y';
    v_pm_product_code VARCHAR2(10);
    ---variables for catching errors---
    v_error_flag number:=0;
    -- Predefined Composite data types
    v_project_in PA_PROJECT_PUB.PROJECT_IN_REC_TYPE;
    v_project_out PA_PROJECT_PUB.PROJECT_OUT_REC_TYPE;
    v_key_members PA_PROJECT_PUB.PROJECT_ROLE_TBL_TYPE;
    v_class_categories PA_PROJECT_PUB.CLASS_CATEGORY_TBL_TYPE;
    v_tasks_in_rec PA_PROJECT_PUB.TASK_IN_REC_TYPE;
    v_tasks_in PA_PROJECT_PUB.TASK_IN_TBL_TYPE;
    v_tasks_out_rec PA_PROJECT_PUB.TASK_OUT_REC_TYPE;
    v_tasks_out PA_PROJECT_PUB.TASK_OUT_TBL_TYPE;
    v_CREATED_FROM_PROJECT_ID varchar2(20);
    v_CARRYING_OUT_ORGANIZATION_ID varchar2(20);
    v_person_id NUMBER;
    v_project_role_type VARCHAR2(20);
    API_ERROR EXCEPTION;
    v_a NUMBER;
    cursor for project in data
    CURSOR cur_project_in_data IS SELECT * FROM XXPA_PROJECT_IN_STG;
    cursor for task data
    CURSOR cur_task_in_data IS SELECT * FROM XXPA_TASK_IN_STG;
    ------------------------Cursors used for validations----------------------------------
    cursor for product code used for validation
    cursor cprc is select distinct PROJECT_RELATIONSHIP_CODE from PA_PROJECT_CUSTOMERS;
    cursor for distribution rule-
    cursor cdr is select DISTRIBUTION_RULE from PA_DISTRIBUTION_RULES;
    cursor for project status code
    cursor cpsc is SELECT PROJECT_STATUS_CODE, PROJECT_STATUS_NAME FROM PA_PROJECT_STATUSES WHERE STATUS_TYPE = 'PROJECT';
    cursor for template/created from project id
    cursor ccpid is select project_id from pa_projects where template_flag='Y';
    BEGIN
    select user_id, responsibility_id into v_user_id, v_responsibility_id
    from PA_USER_RESP_V
    where user_name like 'amit_kumar%'
    and responsibility_name like'PA SupervisorS';
    -- --Fnd_global.apps_initialize(user_id,resp_id, resp_appl_id);
    -- Fnd_global.apps_initialize(v_user_id,v_responsibility_id,275);
    -- -------calling global parameters---
    pa_interface_utils_pub.set_global_info
    p_api_version_number =>v_api_version_number,
    p_responsibility_id =>v_responsibility_id,
    p_user_id =>v_user_id,
    p_msg_count =>v_msg_count,
    p_msg_data =>v_msg_data,
    p_return_status =>v_return_status
    dbms_output.put_line ('Set Global status ->' || v_return_status);
    ----Cursor for PRODUCT RELATED DATA-----------
    FOR REC IN cur_project_in_data LOOP
    -----PASSING VALUES TO THE COMPOSITE DATA TYPE(PROJECT_IN_REC_TYPE)-------
    ----retrieving product code-----
    select lookup_code into v_pm_product_code
    from pa_lookups
    where lookup_type = 'PM_PRODUCT_CODE'
    and meaning = 'Oracle Project Manufacturing';
    -----retrieving and validating created from project id----
    BEGIN
    select project_id
    into v_CREATED_FROM_PROJECT_ID
    from pa_projects_all
    where name=rec.created_from_project_name;
    EXCEPTION
    when others then
    O_Retcode := '1';
    O_Errbuf :='Incorrent CREATED_FROM_PROJECT_NAME';
    Fnd_File.Put_Line (Fnd_File.LOG, O_Errbuf);
    UPDATE XXPA.XXPA_PROJECT_IN_STG
    SET ERROR_FLAG ='1' ,last_updation_date='sysdate' where created_from_project_name = rec.CREATED_FROM_PROJECT_NAME;
    END;
    -----retrieving & validating carrying out organization id-----
    BEGIN
    select distinct(CARRYING_OUT_ORGANIZATION_ID)
    into v_CARRYING_OUT_ORGANIZATION_ID
    from pa_projects_prm_v
    where CARRYING_OUT_ORGANIZATION_NAME=rec.carrying_out_organization_name;
    EXCEPTION
    when others then
    O_Retcode := '1';
    O_Errbuf :='Incorrent Carrying Out Organization name';
    Fnd_File.Put_Line (Fnd_File.LOG, O_Errbuf);
    UPDATE XXPA.XXPA_PROJECT_IN_STG
    SET ERROR_FLAG ='1' ,last_updation_date='sysdate' where carrying_out_organization_name = rec.carrying_out_organization_name;
    END ;
    v_project_in.pm_project_reference := rec.segment1;
    v_project_in.project_name := rec.PROJECT_NAME;
    v_project_in.created_from_project_id := v_CREATED_FROM_PROJECT_ID;
    v_project_in.carrying_out_organization_id := v_CARRYING_OUT_ORGANIZATION_ID;
    v_project_in.project_status_code := rec.PROJECT_STATUS_CODE;
    v_project_in.description := rec.PROJECT_DESCRIPTION;
    v_project_in.start_date := rec.PROJECT_START_DATE;
    v_project_in.completion_date := rec.PROJECT_COMPLETION_DATE;
    v_project_in.distribution_rule := rec.DISTRIBUTION_RULE;
    v_project_in.project_relationship_code := rec.PROJECT_RELATIONSHIP_CODE;
    -------------------------Validation of incoming project data--------------------------------
    v_error_flag := 1;
    project relationship code validation
    BEGIN
    for prc in cprc
    loop
    if (rec.PROJECT_RELATIONSHIP_CODE=prc.PROJECT_RELATIONSHIP_CODE) or (rec.PROJECT_RELATIONSHIP_CODE is null)--can be overridden from template
    then
    v_error_flag :=0;
    else null;
    end if;
    end loop;
    END;
    project distribution rule validation
    BEGIN
    for dr in cdr
    loop
    if (rec.DISTRIBUTION_RULE=dr.DISTRIBUTION_RULE) or (rec.DISTRIBUTION_RULE is null) null since the value can be taken from template too
    then
    v_error_flag :=0;
    else null;
    end if;
    end loop;
    END;
    project status code validation
    BEGIN
    for sc in cpsc
    loop
    if (rec.PROJECT_STATUS_CODE=sc.PROJECT_STATUS_CODE) or (rec.PROJECT_STATUS_CODE is null) null since the value can be taken from template too
    then
    v_error_flag :=0;
    else null;
    end if;
    end loop;
    END;
    dbms_output.put_line ('Error at PROJECT_STATUS_CODE>' ||v_error_flag);
    validation logic for project start date
    BEGIN
    if TRUNC(rec.PROJECT_START_DATE) >= TRUNC(rec.PROJECT_COMPLETION_DATE)
    THEN
    v_error_flag := 1;
    O_Retcode := '1';
    O_Errbuf :='Project start date cannnot be greater than completion date';
    Fnd_File.Put_Line (Fnd_File.LOG, O_Errbuf);
    END IF;
    END;
    validation logic for project completion date
    BEGIN
    if (TRUNC(rec.PROJECT_COMPLETION_DATE)<=TRUNC(rec.PROJECT_START_DATE))
    then
    if ( rec.PROJECT_STATUS_CODE='CLOSED' and rec.PROJECT_COMPLETION_DATE>sysdate)
    THEN
    v_error_flag := 1;
    O_Retcode := '1';
    O_Errbuf :='completion date cannot be greater than sysdate for closed projects';
    Fnd_File.Put_Line (Fnd_File.LOG, O_Errbuf);
    END IF;
    v_error_flag := 1;
    O_Retcode := '1';
    O_Errbuf :='Project closed date cannot be less than start date';
    end if;
    END;
    --------Update staging table for the error records--------
    BEGIN
    if v_error_flag =1
    then
    O_Retcode := '1';
    O_Errbuf :='Incorrect project relationship code';
    Fnd_File.Put_Line (Fnd_File.LOG, O_Errbuf);
    UPDATE XXPA.XXPA_PROJECT_IN_STG
    SET ERROR_FLAG ='1' ,last_updation_date='sysdate' where PROJECT_RELATIONSHIP_CODE = rec.PROJECT_RELATIONSHIP_CODE;
    end if;
    END;
    -----------------------End of validation of incoming project data----------------------------------
    ---------------Project Task DATA-----------------
    v_a:=0;
    FOR tsk IN cur_task_in_data LOOP
    v_tasks_in_rec.pm_task_reference :=tsk.task_reference ;
    v_tasks_in_rec.task_name :=tsk.task_name;
    v_tasks_in_rec.pm_parent_task_reference :=tsk.parent_task_reference ;
    v_tasks_in_rec.task_start_date :=tsk.task_start_date ;
    v_tasks_in_rec.task_completion_date :=tsk.task_completion_date ;
    v_tasks_in(v_a) := v_tasks_in_rec;
    v_a:=v_a+1;
    end loop;
    ---------------end of task details------------------
    --INIT_CREATE_PROJECT
    pa_project_pub.init_project;
    ---------------------CREATE_PROJECT--------------------------
    pa_project_pub.create_project(
    p_api_version_number=> v_api_version_number,
    p_commit => v_commit,
    p_init_msg_list => v_init_msg_list,
    p_msg_count => v_msg_count,
    p_msg_data => v_msg_data,
    p_return_status => v_return_status,
    p_workflow_started => v_workflow_started,
    p_pm_product_code => v_pm_product_code,
    p_project_in => v_project_in,
    p_project_out => v_project_out,
    p_key_members => v_key_members,
    p_class_categories => v_class_categories,
    p_tasks_in => v_tasks_in,
    p_tasks_out => v_tasks_out);
    if v_return_status = 'S'
    then
    UPDATE XXPA.XXPA_PROJECT_IN_STG
    SET INTERFACE_STATUS ='Success' where segment1 = v_project_out.pa_project_number; ---P->pending & S-> Success
    dbms_output.put_line('New Project Id: ' || v_project_out.pa_project_id);
    dbms_output.put_line('New Project Number: ' || v_project_out.pa_project_number);
    else
    UPDATE XXPA.XXPA_PROJECT_IN_STG
    SET INTERFACE_STATUS ='Pending' where segment1 = v_project_out.pa_project_number;
    raise API_ERROR;
    end if;
    END LOOP;
    Commit;
    ------Handling Exception--------
    EXCEPTION
    WHEN api_error THEN
    dbms_output.put_line('An error occured during project creation');
    IF (v_msg_count > 0 ) THEN
    FOR i IN 1..v_msg_count LOOP
    apps.PA_INTERFACE_UTILS_PUB.get_messages(
    p_msg_count => v_msg_count,
    p_encoded => 'F',
    p_msg_index => i,
    p_msg_data => v_msg_data,
    p_data => v_data,
    p_msg_index_out => v_msg_index_out);
    dbms_output.put_line('Error message v_data ->'||v_data);
    dbms_output.put_line('Error message v_msg_data ->'||v_msg_data);
    dbms_output.put_line('Error message v_msg_index_out ->'||v_msg_index_out);
    dbms_output.put_line('Error message p_msg_index ->'||i);
    APPS.fnd_file.put_line(APPS.FND_FILE.LOG,v_data);
    END LOOP;
    END IF;
    WHEN OTHERS THEN
    dbms_output.put_line('An error occured during conversion, SQLCODE ->'|| SQLERRM);
    IF (v_msg_count >=1 ) THEN
    FOR i IN 1..v_msg_count LOOP
    PA_INTERFACE_UTILS_PUB.get_messages(
    p_msg_count => v_msg_count,
    p_msg_index => i,
    p_encoded => 'F',
    p_msg_data => v_msg_data,
    p_data => v_data,
    p_msg_index_out => v_msg_index_out);
    dbms_output.put_line('Error message ->'||v_data);
    APPS.fnd_file.put_line(APPS.FND_FILE.LOG,v_data);
    END LOOP;
    END IF;
    end; --end procedure
    END xxpa_proj_conv_pkg;
    * Please tell me how to assign project specific task with the newly created projects??? *
    Also please tell me how to assign multiple * Project_Relationship_Code * (ex: END CLIENT, GENERAL CONTRACTOR, PRIMARY) for a particular project during project creation?

    Are you not storing the project number in the staging table designed for storing the task data? You can use create_project API to create the project and tasks at the same time with one single call. You may want to try that option

  • Creating multiple mailboxes using Powershell for users who already exist in AD

    Hi there,
    Wondering if anyone can help, I am wanting to use Powershell to run a command which references a CSV file to create a mailbox for a user who already exists in AD.
    It needs to reference the username, to ensure the correct user has a mailbox created (as mentioned they exist already in the domain), place them on a specific database (e.g DB1) and assign them an email address as well as possibly an alias email address
    too.
    Can anyone provide me the headings of the CSV file which would be needed as well as the powershell command to run. It would be great too if I could also set the quota sizes for the user at the same time of creating the mailbox, but if not possible or complicated
    I can run a script afterwards to do this. I would only want to warn them when their mailbox is 1.5GB in size and stop them sending when it reaches 2GB. 
    Thanks

    So create a csv file with the following headers and data
    UserID, Alias
    UserID should be the user SamAccountName, and the Alias is the Mailbox Alias that you want to set. Supposing that the csv file is named users.csv and located under C:\ , open the Exchange Management Console and run:
    $users = Import-Csv c:\users.csv
    Foreach ($user in $users) {
    Enable-Mailbox -Identity $user.UserID -alias $user.alias -database 'DB1'
    Set-Mailbox -Identity $user.UserID -IssueWarningQuota 1.5gb -ProhibitSendQuota 2gb 
    Please Mark As Answer if this helps
    ammarhasayen

  • 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

  • Create SharePoint 2010 Search Service Application Using Powershell

    Hi Team,
    Could you please assist me in completing the search service application for
    two server using powershell. Both the servers will be running all the component
    Version SharePoint 2010
    # 1.Setting up some initial variables.
    write-host 1.Setting up some initial variables.
    $SSAName = "Search Service Application"
    $SVCAcct = "Domain\ServiceAccount"
    $SearchAppPoolName ="DefaultAppPool"
    $SSI = get-spenterprisesearchserviceinstance -local
    $err = $null
    $SSADBName="Search_AdminDB"
    $SSADBServer="DBServer"
    $host1="Server1"
    $host2="Server2"
    # Start Services search services for SSI
    write-host Start Services search services for SSI
    Start-SPEnterpriseSearchServiceInstance -Identity $SSI
    # 2.Create an Application Pool.
    write-host 2.Create an Application Pool.
    #$AppPool = new-SPServiceApplicationPool -name $SSAName"-AppPool" -account $SVCAcct
    $AppPool = Get-SPServiceApplicationPool -Identity $SearchAppPoolName -ErrorAction SilentlyContinue
    # 3.Create the SearchApplication and set it to a variable
    write-host 3.Create the SearchApplication and set it to a variable
    $SearchApp = New-SPEnterpriseSearchServiceApplication -DatabaseServer $SSADBServer -Name $SSAName -applicationpool $AppPool -databasename $SSADBName
    #4 Create search service application proxy
    write-host 4 Create search service application proxy
    $SSAProxy = new-spenterprisesearchserviceapplicationproxy -name $SSAName"ApplicationProxy" -Uri $SearchApp.Uri.AbsoluteURI
    # 5.Provision Search Admin Component.
    write-host 5.Provision Search Admin Component.
    set-SPenterprisesearchadministrationcomponent -searchapplication $SearchApp -searchserviceinstance $SSI
    # 6.Create a new Crawl Topology.
    write-host 6.Create a new Crawl Topology.
    $CrawlTopo = $SearchApp | New-SPEnterpriseSearchCrawlTopology
    New-SPEnterpriseSearchCrawlComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
    Source:blog.MSDN Author- Russ Maxwell
    Thanks Basva

    Could you please assist me in completing the search service application for
    two server using powershell. Both the servers will be running all the component 
    Hi Basva,
    Do you want to provision two search service applications in single farm?
    Commonly, only one search service application is needed in a farm for Search function.
    Here are articles for detail information about how to provision search service application using powershell:
    http://blogs.msdn.com/b/jjameson/archive/2011/02/28/powershell-script-to-configure-search-in-sharepoint-server-2010.aspx
    http://blogs.msdn.com/b/russmax/archive/2009/10/20/sharepoint-2010-configuring-search-service-application-using-powershell.aspx
    Regards,
    Rebecca Tu
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • 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.
    ¯\_(ツ)_/¯

  • Can I use my newly created iCloud email address as my Apple ID?

    Hey,
    I know there have been loads of post regarding iCloud and account issues. I was wondering if it was possible to use my newly created iCLoud email address as my Apple ID and its primary address. I had a hotmail account as my Apple ID before signing up for iCloud. For me it's purely cosmetic and I want to retire that hotmail address.
    Thanks
    Peter

    this has been really bugging me as well, i dont see why we cant do this.
    if you create a new apple id you get the option to use a free icloud email as the apple id, but old users are stuck?

Maybe you are looking for

  • Log file cleaning problem

    Hi, I'm evaluating Berkeley DB Java Edition for my application, and I have the following code: public class JETest {      private Environment env;      private Database myDb;      public JETest() throws DatabaseException {           EnvironmentConfig

  • Af:commandMenuItem action only works first time

    I am using the af:panelPage, and have added a menu1 facet that contains an af:menuTabs component with 3 af:commandMenuItems. I'd like the selection of each tab to invoke a bean 'action', where I'll set some flags that control the rendering of differe

  • Error 10401 - PCI 6023E

    Hello everyone, I have a LabView code running on LabView 6.1 (on Windows 2000).  It has a PCI 6023E DAQ card. Everything was working fine for many days, until suddenly today I got the Error 10401 - occured at AO Single update. if I click OK, the code

  • Error in Sales change Bapi

    I am using BAPI_SALESORDER_CHANGE bapi to add new items. Additionaly i am passing EXTENSIONIN table. I am getting this error message "Inconsistency between a document field and the prof. segment number" for some of the materials. Can you please sugge

  • Installing devices under windows XP on Satellite P200-14H

    Hi, I have recently purchased Satellite P200-14H. It came with Vista home and since CAD software we use in our company doesn't work on it, we installed WXP on it. Everything works fine, we got the system almost fully functional, installed 99% of the