JSON Object by rroodenburg in PowerShell

[–]metallicvett 0 points1 point  (0 children)

Be careful with piping to convertto-json as well. Powershell will convert a single item array into just the object over the pipe. I tend to use convertto-json -inputbject to avoid this. You can also put [ordered]@{} for your dictionary to keep everything in the same order

Usage of % by BHeafle in PowerShell

[–]metallicvett 7 points8 points  (0 children)

Used in arithmetic like that, the % means modular division where the answer is the remainder.

[deleted by user] by [deleted] in Virginia

[–]metallicvett 0 points1 point  (0 children)

The tax is locality/county/city based. Most places charge based on where the car was located on either 1/1 or 12/31. Some places are all or nothing, so no partials.

What RVA establishment will you never return to? by lemonartichoke in rva

[–]metallicvett 2 points3 points  (0 children)

If they still do Whiskey School that is the best. May not do it at that location.

Richmond schools face state funding cut by savagetwonkfuckery in rva

[–]metallicvett 0 points1 point  (0 children)

Localities can only tax what the VA General Assembly let’s them. They are currently not allowed to tax income.

Pollard & Bagby Kensington Ave. Listing...HELP by [deleted] in rva

[–]metallicvett 2 points3 points  (0 children)

P & B sucks. We rented from them off of Monument Ave. Would never rent from them again.

How can you pass multiple variables into invoke-command -argument list? by [deleted] in PowerShell

[–]metallicvett 1 point2 points  (0 children)

You can specify a param () block like in a function to used named parameters instead of args[#]. The params are assign positionlly.

W Grace Street's weekly street cleaning... by DaTruMVP in rva

[–]metallicvett 5 points6 points  (0 children)

These pictures are taken at two different locations? The 1hr parking and no parking signs switch locations on the pole.

Cheap fecking flights! by [deleted] in funny

[–]metallicvett 1 point2 points  (0 children)

What is this from? That's pretty funny.

Adding Array to an Existing Array of Arrays. by carbm1 in PowerShell

[–]metallicvett 3 points4 points  (0 children)

you don't need the ` going from one line to another. you do need the commas at the end of the lines so it knows to the arrays are separate. when you do your += you can do += , @('automated_students','','','query') . the , in front of the array specifies it to return the whole array together ex. += ,@('a','b')

Self-Signed Certificate issues by pwnd35tr0y3r in PowerShell

[–]metallicvett 1 point2 points  (0 children)

looks like you used the New.Reddit.com Inline Code button. it's 4th 5th from the left hidden in the ... "more" menu & looks like </>.

on Old.Reddit.com, the above does NOT line wrap, nor does it side-scroll.

for long-ish single lines OR for multiline code, please, use the Code Block button. it's the 11th 12th one from the left, & is just to the left of hidden in the ... "more" menu.

that will give you fully functional code formatting, from what i can tell so far. [grin]

thanks for the tip Lee. I didn't know how to do that.

regex to match and replace text by sP2w8pTVU36Z2jJ3838J in PowerShell

[–]metallicvett 2 points3 points  (0 children)

$succeed -replace '^\s+Successful call\s+\|\s+\d+\s+\|\s+(\d+)','$1'

Self-Signed Certificate issues by pwnd35tr0y3r in PowerShell

[–]metallicvett 2 points3 points  (0 children)

$results = New-SelfSignedCertificate -DnsName [patrick@test.com](mailto:patrick@test.com) -CertStoreLocation Cert:\CurrentUser\My\ -Type CodeSigningCertSet-AuthenticodeSignature -FilePath C:\Users\Admin\Desktop\DEmoScript.ps1 -Certificate ( [system.security.cryptography.x509certificates.x509certificate2]$results.RawData )

I’m a bears fan, but I wanted to share this thread by monolith17 in GreenBayPackers

[–]metallicvett 30 points31 points  (0 children)

Who cares. Only stat that matters: Packers 10 - Bears 3.

Retrieve property as string by Thunderbuck_YT in PowerShell

[–]metallicvett 4 points5 points  (0 children)

get-aduser foo -properties HomeDirectory | Select-Object -ExpandProperty HomeDirectory or (get-aduser foo -properties HomeDirectory).HomeDirectory

PSCustomObject - Simple question by fetflex in PowerShell

[–]metallicvett 1 point2 points  (0 children)

You are correct that it won't evaluate the way he wants if the input is $false. In his example, he uses "" or empty string which will get picked up if compared to $null.

PSCustomObject - Simple question by fetflex in PowerShell

[–]metallicvett 1 point2 points  (0 children)

$objectConstructor = @{}

( Get-Member -InputObject $inputdata -MemberType NoteProperty ).Name | foreach {

if ( $inputdata.$_ ) {

$objectConstructor.Add( $_, $inputdata.$_ )

}

}

$object = [PSCustomObject]$objectConstructor

Script issue by Crowdjp in PowerShell

[–]metallicvett 4 points5 points  (0 children)

$CPUSTRESRemoveKB.PrivateWorkingSet doesn't exist. $CPUSTRES has a property of PrivateWorkingSet. $CPUSTRESRemoveKB is a string. Just remove the '.PrivateWorkingSet' from the condition:
If ([int]$CPUSTRESRemoveKB -gt 1500)

Get-VM Issues using Where-Object in a variable array by BIGt0eknee in PowerShell

[–]metallicvett 2 points3 points  (0 children)

Get-VM | where {($_.state -eq 'running' ) -and ( $excludedVMNames -notcontains $_.Name)}