Coming soon - Get a detailed view of why an account is flagged as spam!
view details
3
Reading CSV, getting information, exporting data
Post Body

So I have a CSV file with userids, I am importing those IDs, getting computers they are listed as ManagedBy, and want to output it to a text file. But for some reason I'm getting this error

Out-File : Cannot validate argument on parameter 'Encoding'


$UserID = @()
$Asset = @()

Import-Csv "C:\Scripts\FY18 Deskside Tracking Proactive Refresh.csv" |`
ForEach-Object {
Clear-Variable -Name UserID,UserAsset
    $UserID  = $_.UserID
    $Asset  = $_.Asset      
 $UserAsset = (Get-ADComputer -Filter "ManagedBy -eq '$UserID'").SamAccountName
 Write-Output $UserID $UserAsset | Out-File -filepath "C:\Scripts\FY18.txt" $UserAsset $username -Append
  }

Author
Account Strength
100%
Account Age
12 years
Verified Email
Yes
Verified Flair
Yes
Total Karma
66,614
Link Karma
30,920
Comment Karma
35,639
Profile updated: 3 days ago
Posts updated: 9 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
7 years ago