Reputation: 3
I have the following command:
$WSUSClients = Get-WsusComputer | Select-Object FullDomainName, OSDescription, LastSyncResult, RequestedTargetGroupName
$WSUSClients | ForEach-Object {$_.FullDomainName -replace ('.corp.com','')} | Set-Content 'C:\Script\WSUS Clients\WSUSclients.csv'
Last part it not correct I want to replace the .corp.com from the column FullDomainname and still leave the other columns but don't get this working.
Upvotes: 0
Views: 483
Reputation: 1598
just use a custom column:
$prop = @{
name = 'FullDomainName'
Expression = {$_.FullDomainName.replace('.corp.com','')}
}
$WSUSClients = Get-WsusComputer | Select-Object $prop, OSDescription, LastSyncResult, RequestedTargetGroupName $WSUSClients | Set-Content 'C:\Script\WSUS Clients\WSUSclients.csv'
Upvotes: 1