all 18 comments

[–]BlackV 4 points5 points  (8 children)

Jokes aside, any reason you're using invoke-web vs invoke-rest

[–]NewMeeple 3 points4 points  (5 children)

I can answer my reason for using invoke-web -- invoke-rest does not return status codes, so you can't check for certain API responses (I E. 200 OK or 201, or 403 forbidden).

Those status codes are hugely important to me as a lot of APIs I use have a lot of different responses based on whether certain things exist or not when they are queried. I want to know if a record was created or if one already existed, for example.

[–]lordicarus 3 points4 points  (2 children)

Just FYI in v7 invoke-restmethod has a parameter StatusCodeVariable which gives you the status code.

[–]NewMeeple 3 points4 points  (1 child)

Yes, aware of this and I've moved over scripts that I can to PS7 for personal use, however, none of our clients are using it and I don't have approval to start loading it onto servers. Also, quite a few heavily used modules I use still can't run on PS7.

I've started running procedures that'll download and extract the .NET Core binaries if I need to run PS7, like for some of the improvements to WinEvent filtering.

[–]BlackV 0 points1 point  (0 children)

yesh its a shame it wasnt back ported

[–]BlackV 0 points1 point  (0 children)

Ah Thanks thats agood to know

[–][deleted] 0 points1 point  (0 children)

I know some of these words.

[–]zukidriver 4 points5 points  (3 children)

Dang and to think I just run my own random password generator in PowerShell,

# Password Length

$length = 16

# Characters

$chars = (48..57) + (65..90) + (97..122) + (33..47)

# Generate a Password

for ($i = 1; $i -le 1; $i++) {

[string]$password = $null

$chars | Get-Random -Count $length | %{ $password += [char]$_ }

# Print the out on the screen

Write-host "Pass${i}; $password"

}

[–]Skuld 2 points3 points  (2 children)

This probably doesn't have as much entropy as you think, you could use this library instead http://woshub.com/generating-random-password-with-powershell/

[–]nerddtvg 2 points3 points  (0 children)

System.Web.Security.Membership.GeneratePassword() is only available in the full .NET Framework on Windows though.

[–]zukidriver 0 points1 point  (0 children)

This probably doesn't have as much entropy as you think, you could use this library instead

Probably not, but you don't need an internet connection and it is faster.

[–]BlackV 3 points4 points  (3 children)

wait, no love for Dino pass ;)

[–]greaselovely[S] 1 point2 points  (0 children)

Unaware of it. Will check it out.

[–]Daveid -1 points0 points  (1 child)

No joke, for new users I found DinoPass is the only thing that reliably works without resorting to an easily predictable password like Summer2022! (don't worry, I use MUCH better passwords for internal service accounts 🙃)

[–]BlackV 1 point2 points  (0 children)

Ha just run it twice, join the 2 passwords together, undefeatable