Add-Member -MemberType NoteProperty -Name EmployeeNumber ...

:)

From: Candee [mailto:can...@gmail.com]
Sent: Wednesday, April 17, 2013 1:47 PM
To: NT System Admin Issues
Subject: Re: PowerShell noob help

the problem is getting it in the array.
I tried this at the top:
$createdusers = @()
$employeenumber = @()

and then this at the end, but no matter what I user, I can't get it to export.
I know I'm not doing it right, but I *think* I'm on the right track.


$employeenumber += employeenumber

              $createdusers += $Newuser
              $createdusers|select 
name,displayname,email,employeenumber|export-csv 
"C:\temp\scripts\Epicor_export.csv" -notype
              $employeenumber |select employeenumber |export-csv 
"C:\temp\scripts\empnum.csv" -notype

On Wed, Apr 17, 2013 at 1:20 PM, Guyer, Don 
<dgu...@che.org<mailto:dgu...@che.org>> wrote:
I'm a PS noob myself but, trying to learn so excuse me if I'm wrong 
but...........wouldn't the column heading be "employeegui"?

-oa 
@{ipphone=$_.ipphone;mobile=$_.mobile;employeeid=$_.employeeid;employeenumber=$_.employeegui}
 `


Regards,

Don Guyer
Catholic Health East - Information Technology
Enterprise Directory & Messaging Services
3805 West Chester Pike, Suite 100, Newtown Square, Pa  19073
email: dgu...@che.org<mailto:dgu...@che.org>
Office:  610.550.3595<tel:610.550.3595> | Cell: 610.955.6528<tel:610.955.6528> 
| Fax: 610.271.9440<tel:610.271.9440>
For immediate assistance, please open a Service Desk ticket or call the 
helpdesk @ 610-492-3839<tel:610-492-3839>.
[Description: Description: Description: InfoService-Logo240]

From: Candee [mailto:can...@gmail.com<mailto:can...@gmail.com>]
Sent: Wednesday, April 17, 2013 11:48 AM

To: NT System Admin Issues
Subject: Re: PowerShell noob help

nah, I tried that. The column heading is employeenumber, but no data is 
exported.
I have to add the attribute to the $creatednames array somehow.

On Wed, Apr 17, 2013 at 11:20 AM, Guyer, Don 
<dgu...@che.org<mailto:dgu...@che.org>> wrote:
Wouldn't you just change "$createdusers|select 
name,displayname,email|export-csv "C:\temp\scripts\Epicor_export.csv" -notype" 
to
"$createdusers|select name,displayname,employeenumber,email|export-csv 
"C:\temp\scripts\Epicor_export.csv" -notype"?

Regards,

Don Guyer
Catholic Health East - Information Technology
Enterprise Directory & Messaging Services
3805 West Chester Pike, Suite 100, Newtown Square, Pa  19073
email: dgu...@che.org<mailto:dgu...@che.org>
Office:  610.550.3595<tel:610.550.3595> | Cell: 610.955.6528<tel:610.955.6528> 
| Fax: 610.271.9440<tel:610.271.9440>
For immediate assistance, please open a Service Desk ticket or call the 
helpdesk @ 610-492-3839<tel:610-492-3839>.
[Description: Description: Description: InfoService-Logo240]

From: Candee [mailto:can...@gmail.com<mailto:can...@gmail.com>]
Sent: Wednesday, April 17, 2013 10:46 AM

To: NT System Admin Issues
Subject: Re: PowerShell noob help

Thanks!
I will see if I can figure out how.
:)

On Wed, Apr 17, 2013 at 9:19 AM, Michael B. Smith 
<mich...@smithcons.com<mailto:mich...@smithcons.com>> wrote:
I don't use the QAD tools, but my guess is that New-QadUser does not return 
employeeNumber as one of the attributes of the resulting object.  You would 
need to add that.

From: Candee [mailto:can...@gmail.com<mailto:can...@gmail.com>]
Sent: Wednesday, April 17, 2013 8:37 AM

To: NT System Admin Issues
Subject: Re: PowerShell noob help

Okay you guys...
here it is; credit card numbers changed to protect the innocent.
;)

Any advice is appreciated - I can take it. Really.
When it's done it sends the logs and newusers file to me.
Thanks all!
___________________________________________

#Import from HR
#Create SAM, UPN
#modified 4/16/2013 - CDV

Import-module activedirectory
add-PSSnapin quest.activeroles.admanagement
$newusers = "C:\temp\scripts\newusers_ver2.csv"
$date = Get-Date

#Exchange database for new mailboxes
$userdb = "ops"

#specify path to save log file
$logpath = "C:\temp\scripts\Error.logs"

#parent container for all new users
$OU = 'ourdomain.local/organization/internal/us/greene/newusers'

#create password
$pass = ConvertTo-SecureString -asplaintext R@ym0nd!! -Force

#Set Domain Controller
Set-ADServerSettings -PreferredServer usnygrds01.ourdomain.local

#Set Domain root
$DNSROOT = '@'+"ourdomain.com<http://ourdomain.com/>"

Start-Transcript C:\temp\scripts\Epicor_Import.logs -append
$createdusers = @()
Import-Csv $newusers |foreach {
$preferredfirstname = $_.preferredfirstname
$lastnamepreferred = $_.lastnamepreferred
$SAM = $preferredfirstname.substring(0,1)+$lastnamepreferred
$UPN = $preferredfirstname +"."+$lastnamepreferred+$DNSROOT
$Displayname = $lastnamepreferred +" "+$preferredfirstname
$Email = $UPN
$testemail = get-recipient -identity $email -ErrorAction SilentlyContinue
$user = Get-QADUser -SamAccountName $SAM


if($user -ne $Null) {

"
*********************************************************************************

$($User.name) already exists -
*****THIS USER NEEDS TO BE MANUALLY CREATED*****
"

} Elseif ($testemail -ne $Null) {
"
*********************************************************************************

$($DISPLAYNAME) Email address already exists
*****THIS MAILBOX NEEDS TO BE MANUALLY CREATED*****"

}ELSE{
"
*********************************************************************************

Creating a new user account for $($DISPLAYNAME)"

$NewUser = New-qaduser -name $SAM `
-parentcontainer $OU `
-userprincipalname $UPN `
-samaccountname $SAM `
-displayname $displayname `
-mail $email `
-givenname $_.preferredfirstname`
-sn $_.lastnamepreferred `
-userPassword $pass `
-company $_.Company `
-department $_.department -title $_.businesscardtitle -telephonenumber 
$_.telephone `
-city $_.city -postalcode $_.zip -state $_.state `
-streetaddress $_.street -manager $_.manager `
-oa 
@{ipphone=$_.ipphone;mobile=$_.mobile;employeeid=$_.employeeid;employeenumber=$_.employeegui}
 `

start-sleep -s 10

if($_.mailenabled -eq 'true') {
"Creating a mailbox for $($Newuser.name)"
$Newuser |foreach-object {enable-mailbox -identity $newuser.email -database 
$userdb } `
}Else {
"User does not require Email"


}#end of mailenabled

}#end of create new user
$createdusers += $Newuser
$createdusers|select name,displayname,email|export-csv 
"C:\temp\scripts\Epicor_export.csv" -notype
}

Stop-transcript

On Wed, Apr 17, 2013 at 7:30 AM, Webster 
<webs...@carlwebster.com<mailto:webs...@carlwebster.com>> wrote:
That is why you publish your code so others can use it and help you refine it.

Carl Webster
Consultant and Citrix Technology Professional
http://www.CarlWebster.com<http://www.carlwebster.com/>


From: James Rankin [mailto:kz2...@googlemail.com<mailto:kz2...@googlemail.com>]
Sent: Wednesday, April 17, 2013 4:43 AM

To: NT System Admin Issues
Subject: Re: PowerShell noob help

Well that lil' bit of PS worked so well I did a blog post about it (naturally 
with appropriate credits)

http://appsensebigot.blogspot.co.uk/2013/04/flagging-os-of-device-connecting-to.html

This is about the time I will find out it doesn't work on anyone else's 
infrastructure and have to spend weeks rewriting it :-(




~ Finally, powerful endpoint security that ISN'T a resource hog! ~

~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to 
listmana...@lyris.sunbeltsoftware.com<mailto:listmana...@lyris.sunbeltsoftware.com>
with the body: unsubscribe ntsysadmin


~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to 
listmana...@lyris.sunbeltsoftware.com<mailto:listmana...@lyris.sunbeltsoftware.com>
with the body: unsubscribe ntsysadmin

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to 
listmana...@lyris.sunbeltsoftware.com<mailto:listmana...@lyris.sunbeltsoftware.com>
with the body: unsubscribe ntsysadmin


~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to 
listmana...@lyris.sunbeltsoftware.com<mailto:listmana...@lyris.sunbeltsoftware.com>
with the body: unsubscribe ntsysadmin

Confidentiality Notice:

This e-mail, including any attachments is the
property of Catholic Health East and is intended
for the sole use of the intended recipient(s).
It may contain information that is privileged and
confidential.  Any unauthorized review, use,
disclosure, or distribution is prohibited. If you are
not the intended recipient, please delete this message, and
reply to the sender regarding the error in a separate email.


~ Finally, powerful endpoint security that ISN'T a resource hog! ~

~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to 
listmana...@lyris.sunbeltsoftware.com<mailto:listmana...@lyris.sunbeltsoftware.com>
with the body: unsubscribe ntsysadmin


~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to 
listmana...@lyris.sunbeltsoftware.com<mailto:listmana...@lyris.sunbeltsoftware.com>
with the body: unsubscribe ntsysadmin

Confidentiality Notice:
This e-mail, including any attachments is the
property of Catholic Health East and is intended
for the sole use of the intended recipient(s).
It may contain information that is privileged and
confidential.  Any unauthorized review, use,
disclosure, or distribution is prohibited. If you are
not the intended recipient, please delete this message, and
reply to the sender regarding the error in a separate email.


~ Finally, powerful endpoint security that ISN'T a resource hog! ~

~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to 
listmana...@lyris.sunbeltsoftware.com<mailto:listmana...@lyris.sunbeltsoftware.com>
with the body: unsubscribe ntsysadmin


~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to 
listmana...@lyris.sunbeltsoftware.com<mailto:listmana...@lyris.sunbeltsoftware.com>
with the body: unsubscribe ntsysadmin

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to listmana...@lyris.sunbeltsoftware.com
with the body: unsubscribe ntsysadmin

<<inline: image001.jpg>>

Reply via email to