Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Format list Error & Modification

$
0
0

Hello Everyone,

kindly assist with this two questions;

  1. I have a power shell script that creates a user in the AD and exchange but at the end i want it to display the details of the created user. it works fine but it give an error instead of displaying the user details, please help identify my mistake 

The error is...

out-lineoutput : The object of type "Microsoft.PowerShell.Commands.Internal.Format.FormatStartData" is not valid or not
 in the correct sequence. This is likely caused by a user-specified "format-list" command which is conflicting with the
 default formatting.
    + CategoryInfo          : InvalidData: (:) [out-lineoutput], InvalidOperationException
    + FullyQualifiedErrorId : ConsoleLineOutputOutOfSequencePacket,Microsoft.PowerShell.Commands.OutLineOutputCommand

My Code is.

.

write-host -foregroundcolor Green "New Account Created Successfully See the Summary Below in 15 seconds"
Get-ADPrincipalGroupMembership $username | fl name
Get-Mailbox $username | fl DistinguishedName, Name, WindowsEmailAddress, OrganizationalUnit, Database

 2. I would like the script to act on some choices but i dont know how to do it. i.e i would like a use to have 3 choices, once he presses 1 the user is created in a specific AD OU and specific Exchange database. also i would to have other options where upon pressing a number in the choices given the user is added to a given AD group or basic perform certain operations on the account. Inserting the options on the script is the challenge for me please help.

Am running the script on Server 2008 R2 powershell with option import system modules


Meshack




Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>