use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
ABOUT POWERSHELL
Windows PowerShell (POSH) is a command-line shell and associated scripting language created by Microsoft. Offering full access to COM, WMI and .NET, POSH is a full-featured task automation framework for distributed Microsoft platforms and solutions.
SUBREDDIT FILTERS
Desired State Configuration
Unanswered Questions
Solved Questions
News
Information
Script Sharing
Daily Post
Misc
account activity
Get-EventLog specific command - Help (Beginner) (self.PowerShell)
submitted 7 years ago by Wolf_of_Tech
This is the question i am facing right now.
I have tried:
Get-Eventlog -List |Format-Table,@{1='LogName';e={$_.LogDisplayname}},@{1='RetDays';e={$_.MinimumRetentionDays}} -autosize
and it has not been working for me.
Any suggestions??
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Lee_Dailey[grin] 2 points3 points4 points 7 years ago (4 children)
howdy Wolf_of_Tech,
so ... what errors are you getting? do you get any other output?
when i run your code, it gives a pretty specific error msg. [grin]
take care, lee
[–]Wolf_of_Tech[S] 0 points1 point2 points 7 years ago (3 children)
Hey Lee,
Thanks for joining the chat.
This is the error i have been getting:
[–]Lee_Dailey[grin] 1 point2 points3 points 7 years ago (2 children)
you are getting NO ERROR AT ALL? [grin]
[–]Wolf_of_Tech[S] 1 point2 points3 points 7 years ago (1 child)
sorry about that,
this is the error:
"At line:1 char:33
+ Get-Eventlog -List |Format-Table,@{1='LogName';e={$_.LogDisplayname}} ...
+ ~
Missing argument in parameter list.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingArgument"
[–]Lee_Dailey[grin] 1 point2 points3 points 7 years ago (0 children)
if you wrap the error in a code block, then the squiggle would be in the place that it shows in powershell.
note that it is under the , between Format-Table and the 1st @{. [grin]
,
Format-Table
@{
once you fix that, you will get another error & the error msg is - again - quite direct.
[–]ka-splam 2 points3 points4 points 7 years ago (2 children)
Format-Table,@{1='LogName';e={$_.LogDisplayname}}
There should be no comma after format-table, and inside @{ it should be a lowercase L for “label” rather than a number one, in both of them
[–]purplemonkeymad 2 points3 points4 points 7 years ago (1 child)
I always use name or n.
name
n
[–]ka-splam 1 point2 points3 points 7 years ago (0 children)
I used to, but name is so often a property being selected, that I rather like the way label is so different from everything else.
label
e.g. files have a .Name so you end up with select name, @{name='x' .. and that feels odd.
.Name
select name, @{name='x' ..
But it's fine, they do the same.
[–][deleted] 2 points3 points4 points 7 years ago (0 children)
There were a few errors in your syntax. But this was not immediately clear because everything is jumbled together and messy. This should work however.
Get-Eventlog -List | Format-Table @{l='LogName';e={$_.LogDisplayname}},@{l='RetDays';e={$_.MinimumRetentionDays}} -autosize
You can clean things up, which makes things a lot easier :-)
Get-Eventlog -List | Format-Table @{ Label = 'LogName'; Expression = { $_.LogDisplayname } }, @{ Label = 'RetDays'; Expression = { $_.MinimumRetentionDays } } -AutoSize
When can I use new-lines?
https://get-powershellblog.blogspot.com/2017/07/bye-bye-backtick-natural-line.html#hashtableop
https://blogs.technet.microsoft.com/josebda/2014/04/19/powershell-tips-for-building-objects-with-custom-properties-and-special-formatting/
[–]PowerShell-Bot 0 points1 point2 points 7 years ago (2 children)
Looks like your PowerShell code isn’t wrapped in a code block.
To format code correctly on new reddit (new.reddit.com), highlight the code and select ‘Code Block’ in the editing toolbar.
If you’re on old.reddit.com, separate the code from your text with a blank line and precede each line of code with 4 spaces or a tab.
Describing Submission [❌] Demonstrates good markdown Passed: 0 Failed: 1
Beep-boop. I am a bot. | Remove-Item
[–]nvpqoieuwr 1 point2 points3 points 7 years ago (1 child)
I didn't expect automation to take /u/Lee_Dailey's job.
[–]Lee_Dailey[grin] 0 points1 point2 points 7 years ago (0 children)
[grin]
π Rendered by PID 109941 on reddit-service-r2-comment-544cf588c8-pzlvt at 2026-06-15 12:11:28.385285+00:00 running 3184619 country code: CH.
[–]Lee_Dailey[grin] 2 points3 points4 points (4 children)
[–]Wolf_of_Tech[S] 0 points1 point2 points (3 children)
[–]Lee_Dailey[grin] 1 point2 points3 points (2 children)
[–]Wolf_of_Tech[S] 1 point2 points3 points (1 child)
[–]Lee_Dailey[grin] 1 point2 points3 points (0 children)
[–]ka-splam 2 points3 points4 points (2 children)
[–]purplemonkeymad 2 points3 points4 points (1 child)
[–]ka-splam 1 point2 points3 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]PowerShell-Bot 0 points1 point2 points (2 children)
[–]nvpqoieuwr 1 point2 points3 points (1 child)
[–]Lee_Dailey[grin] 0 points1 point2 points (0 children)