PaulRKrueger
asked on
PowerShell Function Output
I'm calling the attached module (found here: http://gallery.technet.microsoft.com/scriptcenter/Get-LockedOutLocation-b2fd0cab) from the following PowerShell script:
The output I expect is:
However, what I get is this:
How can I get the detailed lock information to show up before the "enter to continue" line. The function's done at that point, right?
$Identity = Read-Host 'Please enter the user name of the locked account (e.g. jdoe)'
Get-LockedOutLocation -Identity $Identity
Read-Host 'Press Enter to continue...' | Out-Null
The output I expect is:
PS C:\Users\pkrueger\Desktop> C:\Users\pkrueger\Desktop\test.ps1
Please enter the user name of the locked account (e.g. jdoe): pktesting
Name LockedOut DomainController BadPwdCount AccountLockoutTime LastBadPasswordAttempt
---- --------- ---------------- ----------- ------------------ ----------------------
pktesting True DC1.fubar.domain.com 0 12/16/2013 3:08:28 PM 6/3/2013 2:16:53 PM
pktesting True DC2.fubar.domain.com 0 12/16/2013 3:08:28 PM 4/23/2013 9:48:48 AM
pktesting True DC3.fubar.domain.com 6 12/16/2013 3:08:28 PM 12/16/2013 3:08:28 PM
pktesting True DC4.fubar.domain.com 0 12/16/2013 3:08:28 PM 2/21/2013 10:25:01 AM
User : pktesting
DomainController : DC1.fubar.domain.com
EventId : 4740
LockedOutTimeStamp : 12/16/2013 3:08:28 PM
Message : A user account was locked out.
LockedOutLocation : DUMMYSTATION1
Press Enter to continue...:
However, what I get is this:
PS C:\Users\pkrueger\Desktop> C:\Users\pkrueger\Desktop\test.ps1
Please enter the user name of the locked account (e.g. jdoe): pktesting
Name LockedOut DomainController BadPwdCount AccountLockoutTime LastBadPasswordAttempt
---- --------- ---------------- ----------- ------------------ ----------------------
pktesting True DC1.fubar.domain.com 0 12/16/2013 3:08:28 PM 6/3/2013 2:16:53 PM
pktesting True DC2.fubar.domain.com 0 12/16/2013 3:08:28 PM 4/23/2013 9:48:48 AM
pktesting True DC3.fubar.domain.com 6 12/16/2013 3:08:28 PM 12/16/2013 3:08:28 PM
pktesting True DC4.fubar.domain.com 0 12/16/2013 3:08:28 PM 2/21/2013 10:25:01 AM
Press Enter to continue...:
User : pktesting
DomainController : DC1.fubar.domain.com
EventId : 4740
LockedOutTimeStamp : 12/16/2013 3:08:28 PM
Message : A user account was locked out.
LockedOutLocation : DUMMYSTATION1
How can I get the detailed lock information to show up before the "enter to continue" line. The function's done at that point, right?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER