header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
New-QADObject error
Last Post 20 Nov 2011 09:34 PM by Roy Atkins. 2 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
GregUser is Offline
New Member
New Member
Posts:38
Avatar

--
16 Feb 2009 07:40 AM
    I am writing a script to create accounts and contacts in AD. Each account gets a contact as well, but I want to create the contact first and then the account. I am using the comlet New QADObject to create the contact, but I am receiving the following error:

    Missing expression after unary operator '-'.
    At E:\scripts\CreateStudentAccounts.ps1:39 char:11
    +          -O <<<< bjectAttributes @{givenName=$_.FirstName;

    This is the command I am using:

    New-QADObject -ParentContainer $Contact_OU -Type Contact -ObjectAttributes @{givenName=$_.FirstName; sn=$_.LastName; cn=$_.DisplayName; displayName=$_.DisplayName; mail=$_.EmailAddress; mailNickname=$_.Name; title=$_.Title; company=$_.Company; targetAddress='SMTP:'+$_.EmailAddress} -WhatIf

    I don't see a problem. Any thoughts? Thanks.
    GregUser is Offline
    New Member
    New Member
    Posts:38
    Avatar

    --
    16 Feb 2009 07:42 AM
    By the way, the contact is mail enabled. Their account will be mail enabled as well and we setup a forwarding to their contact email address.
    Roy AtkinsUser is Offline
    New Member
    New Member
    Posts:1
    Avatar

    --
    20 Nov 2011 09:34 PM
    Bit late, I know.

    Two things
    1. You're missing the -Name parameter. This will set the common name (cn) for the object.
    2. You cannot use -ObjectAttributes paremeter to set the cn. This is why we have the rename-qadobject cmdlet.
    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer