Share via


PowerShell Tips and Tricks: Manipulating Outputs in PowerShell

Question

We would like to get SIP address of all users in our domain. Could you please write a PowerShell script?

Answer

Yes, but why write a script? Why not use the below code:

Code
001
002
003
Get-QADuser -SizeLimit 0 | 
Select -ExpandProperty ProxyAddresses | Select-String -CaseSensitive "SIP:" | 
Export-Csv C:\temp\SIPID.csv
Can we manipulate the output?

We don't need SIP: in the CSV. The easy way to do it in Excel CTRL+A , CTRL+F. Replace SIP with white space :) Fine, how to manipulate it using PowerShell code?

001
002
003
004
005
Get-QADuser -SizeLimit 50 | 
%{$SIP = $_.ProxyAddresses | 
Select-String -CaseSensitive "SIP:" $SIP -replace "SIP:" | 
Export-Csv C:\Temp\SIPID.CSV}