Jump to content
EduGeek EdSec 2026 is Go! 27th Oct in Derby! Join us for a day of EdTech security focused talks, networking, and an evening social ×

Recommended Posts

Posted (edited)

Hi there,

I've been asked to create x20 ICTEXAM accounts that need MS Office access and an email address.

 

I have created the accounts on the RM CC3 system and have also created the Linked A/c's on the Admin domain where Exchange 2010 lives.

 

I have:

created a AD group for the accounts and added the members

created a Mailbox DB on Exchange mounted the DB

Set some restrictions for the DB

 

But when I try the following command to try and get Exchange creating mail a/cs for the linked users:

$creds = get-credential (credentials of admin user in the pupil domain)

 

$Users = get-user -Filter {(MemberOfGroup -eq 'cn=ICT Exam Grp1,OU=KHS Groups,DC=khs-admin,DC=internal')}

(gets all disabled users in domain that need to be enabled)

 

foreach ($User in $Users) {

$userIdentity = $User.Identity

$userUsername = 'DOMAIN_REMOVED\' + $User.SamAccountName

$userRecpType = $User.RecipientType

 

if ($userRecpType -eq "User") {

Enable-Mailbox -Identity $userIdentity -Database 'KHS-EX-01\ICT Exam Mailbox Database' -LinkedMasterAccount

$userUsername -LinkedDomainController 'KHS-SR-001' -LinkedCredential $creds

}

}

 

I get the following error:

 

[PS] C:\Windows\system32>$creds = get-credential (credentials of admin user in the pupil domain)

The term 'credentials' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the

spelling of the name, or if a path was included, verify that the path is correct and try again.

At line:1 char:69

+ $creds = get-credential (credentials <<<< of admin user in the pupil domain)

+ CategoryInfo : ObjectNotFound: (credentials:String) [], CommandNotFoundException

+ FullyQualifiedErrorId : CommandNotFoundException

 

[PS] C:\Windows\system32>

[PS] C:\Windows\system32>$Users = get-user -Filter {(MemberOfGroup -eq 'cn=ICT Exam Grp1,OU=KHS Groups,DC=khs-admin,DC=i

nternal')}

[PS] C:\Windows\system32> (gets all disabled users in domain that need to be enabled)

The term 'gets' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelli

ng of the name, or if a path was included, verify that the path is correct and try again.

At line:1 char:86

+ (gets <<<< all disabled users in dom

ain that need to be enabled)

+ CategoryInfo : ObjectNotFound: (gets:String) [], CommandNotFoundException

+ FullyQualifiedErrorId : CommandNotFoundException

 

[PS] C:\Windows\system32>

[PS] C:\Windows\system32>foreach ($User in $Users) {

>> $userIdentity = $User.Identity

>> $userUsername = 'DOMAIN_REMOVED\' + $User.SamAccountName

>> $userRecpType = $User.RecipientType

>>

>> if ($userRecpType -eq "User") {

>> Enable-Mailbox -Identity $userIdentity -Database 'KHS-EX-01\ICT Exam Mailbox Database

' -LinkedMasterAccount

>> $userUsername -LinkedDomainController 'KHS-SR-001' -L

inkedCredential $creds

>> }

>> }

 

Any ideas?

Edited by bodminman
Posted

hehe I mean you've got explainations in the script i.e.:

 

$creds = get-credential (credentials of admin user in the pupil domain)

 

and have following it given us the output of the script that still has those explainations in it:

 

[PS] C:\Windows\system32>$creds = get-credential (credentials of admin user in the pupil domain)

The term 'credentials' is not recognized as the name of a cmdlet, function, script file, or operable program.

 

;)

Posted

LOL - Cheers

 

Removed the explanations but still have an error:

 

You must provide a value expression on the right-hand side of the '-' operator.

At line:7 char:80

+ $userUsername - <<<< LinkedDomainController 'KHS-SR-001' -LinkedCredential $creds

+ CategoryInfo : ParserError: ( : ) [], ParentContainsErrorRecordException

+ FullyQualifiedErrorId : ExpectedValueExpression

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...