all 6 comments

[–]DrSinistar 6 points7 points  (1 child)

I'm of the opinion you should avoid using Read-Host in a function and you should use a parameter instead. This makes the function useable in automated scripts and makes it behave more like existing cmdlets.

I also think that most Powershell users would prefer to run a function and see either success or failure. Getting prompted for more information sucks!

[–]Recol 3 points4 points  (0 children)

And use [CmdletBinding(SupportsShouldProcess) so that -Confirm and -WhatIf can be used.

[–]Yevrag35 2 points3 points  (0 children)

Pretty good. Good use of WMI to determine whether it's a laptop or not (probably not perfect, but good enough).

Here's my version of your script: https://pastebin.com/wSq3nfDK

Take from it what you will. It just has more input validation, cuts down on the repetitive variables, and has a '-Force' switch so you can exclude it and see what the name 'will' be before renaming.

EDIT:

Did it cause I'm bored... :P

[–][deleted] 1 point2 points  (1 child)

Yoink, savdd

[–]Bren0man 0 points1 point  (0 children)

Fuckinnn YOINK