Power Script help adding text to value on export

I have the following Power shell script which work
But i am looking to add a text value to the manager name when blank  (473                           barvec                        Username@sv.org.uk ) I am exporting into a csv doc
Get-ADUser -Filter * -Properties SamAccountName,mail,manager,EmployeeID | ?{$_.EmployeeID -ne $null} | Select-Object -Property employeeID,sAMAccountName,mail,@{N='Manager';E={(Get-ADUser $_.Manager).sAMAccountName}} | Export-csv "\\svr-file1\working_folders\HR\MyPal\Exports\AD.csv

The out put look like this
employeeID      sAMAccountName                           mail                        Manager"
459                           duquesnea               Username@sv.org.uk        mclachlans
480                           brooksp                    Usernames@sv.org.uk       irvinep
473                           barvec                       Username@sv.org.uk
752                           mittona                     Username@sv.org.uk        dunnm
779                           reidk                          Username@sv.org.uk        griffithsj
479                           bridger                      Username@sv.org.uk        woolleyd

I am looking to get the out put to show the following
employeeID      sAMAccountName                           mail                        Manager"
459                           duquesnea               Username@sv.org.uk        mclachlans
480                           brooksp                    Usernames@sv.org.uk       irvinep
473                           barvec                       Username@sv.org.uk        Not Set
752                           mittona                     Username@sv.org.uk        dunnm
779                           reidk                          Username@sv.org.uk        griffithsj
479                           bridger                      Username@sv.org.uk        woolleyd
darran fenaroliAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

oBdACommented:
Try this; and when it comes to AD queries, filter in AD whenever possible; in this case, use an AD filter {employeeID -like '*'} instead of the "Where-Object" filter in PowerShell.
Get-ADUser -Filter {employeeID -like '*'} -Properties SamAccountName, mail, manager, EmployeeID |
	Select-Object -Property employeeID, sAMAccountName, mail, @{N='Manager'; E={Try {(Get-ADUser $_.Manager -ErrorAction Stop).sAMAccountName} Catch {'Not Set'}}} |
	Export-Csv -NoTypeInformation -Path "\\svr-file1\working_folders\HR\MyPal\Exports\AD.csv"

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
Or you can "patch" the value after selecting:
Get-ADUser -Filter {employeeID -like '*'} -Properties SamAccountName,mail,manager,EmployeeID |
  Select-Object employeeID, sAMAccountName, mail, @{N='Manager'; E={(Get-ADUser $_.Manager).sAMAccountName}} |
  % { if (!$_.Manager} { $_.Manager = "Not Set" }; $_ }

Open in new window

oBdACommented:
Question answered.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.