Forum Discussion
Harry_S_S
Jun 30, 2023Copper Contributor
Brackets around negative numbers (formatting)
I am trying to get to grips with the basics of excel at the moment and just trying to sort out some optimal settings. In finance I think its standard for negative numbers to be in brackets i...
- Jul 26, 2022
Yes, You have some things to consider in your script.
First $uidnum is invalid as it return the user DN "CN=User,DC=MyDC ...." not the employeeID
Second , you need to cast the $empid to be Int not String otherwise the int conversion will fail.
Here is an update
Please Check and let me know
$allusers = Get-ADUser -Filter "employeeID -ge 0" -Properties Name,employeeID,uidNumber foreach ($user in $allusers) { [int]$empid = (Get-ADUser $user -Property EmployeeID).EmployeeID if ($user.uidNumber -eq $null) { $uidnum = "1"+'{0:d5}' -f $empid Set-ADUser -Identity $user.SamAccountName -Replace @{uidNumber=$uidnum} } }
SergeiBaklan
Nov 21, 2023MVP
Thanks for the illustration of already mentioned link https://support.microsoft.com/en-us/office/negative-numbers-aren-t-showing-with-parentheses-in-excel-682a1cc5-701a-4ce7-92db-cc9eebc5ffa0
Obieey
Jun 19, 2024Copper Contributor
Thank you. Works. Problem solved.
- SergeiBaklanJun 19, 2024MVP
Obieey , you are welcome