shell-intune-samples icon indicating copy to clipboard operation
shell-intune-samples copied to clipboard

Manage Accounts scripts issue

Open cashxx opened this issue 3 years ago • 3 comments

In the Manage Accounts scripts, the line that creates the password from serial is a small problem as it adds padding at the end with == for the password and if you have in the policy or configuration profile to now allow simple passwords it won't let you login as local admin because of the == at the end.

p=system_profiler SPHardwareDataType | awk '/Serial/ {print $4}' | tr '[A-Z]' '[K-WA-C]' | tr 3-6 4-90-3 | base64

Any idea on how to stop the padding or if it happens strip it so only the serial number of the computer is converted?

cashxx avatar Jan 26 '22 06:01 cashxx

You can add | sed 's/=//g' to the end of that line to remove the padding:

p=`system_profiler SPHardwareDataType | awk '/Serial/ {print $4}' | tr '[A-Z]' '[K-ZA-J]' | tr 0-9 4-90-3 | base64 | sed 's/=//g'`

MaxXyzzy avatar Jan 29 '22 05:01 MaxXyzzy

Ahh forgot about sed. Thanks, didn't think of that, will make note of that and try it. Should be added to script as not allow simple passwords I would think would be common setting people set. I also noticed that the password is spread all through logs. Not sure that is a good thing. This isn't the safest setup, but something and better than having the same password on everything. Thank you!

cashxx avatar Jan 29 '22 16:01 cashxx