Asked by:
Delete

Question
-
Please delete, wrong section
- Edited by GodzFire Monday, March 5, 2018 3:31 PM Please delete, wrong section
- Moved by Bill_Stewart Wednesday, May 30, 2018 6:27 PM User removed question
Monday, March 5, 2018 2:00 PM
All replies
-
Help Import-Csv -Online
Read the examples on how to use a CSV. It does not work with Get-Content.
\_(ツ)_/
- Edited by jrv Monday, March 5, 2018 2:04 PM
Monday, March 5, 2018 2:04 PM -
Why would you want to get rid of the error text. It tells you what you're doing wrong.
I would suggest that you format you code better and also learn how to interact with CSV files. currently you are not putting anything in the samaccountname and display name variables. Also you use IMPORT-CSV and not get-content.
You need to get the header from the CSV file. Example below:
$CSVImport = Import-CSV #PATHTOFILE foreach ($I in $CSVImport){ $samaccountname = $i.samaccountnameheader $displayname = $i.displaynameheader }
Please take the time to learn PowerShell before trying to glue incorrect bits together as it doesn't help you learn and can cause serious problems if you're not careful.Monday, March 5, 2018 2:06 PM -
Hmm???
Here is how to inspect a CSV:
Import-Csv | select -first 1
Now you see the headers with one line of data.
Use "select SamAccountName, displayname" to get those columns only assuming that is the columns in the CSV.
Start by lookin up CSV to see what it is then read the help
Google or Bing type in "CSV" and read the articles returned. Wikipedia has a good one.
\_(ツ)_/
Monday, March 5, 2018 2:10 PM -
This is not a free script fixing service.
Please carefully review the following links to set your expectation for posting in technical forums.
This Forum is for Scripting Question Rather than script requests
From a Bill Stewart summary of useful forum links:
- Posting guidelines
- Handy tips for posting to this forum
- How to ask questions in a technical forum
- Rubber duck problem solving
- How to write a bad forum post
- Help Vampires: A Spotter's Guide
- This forum is for scripting questions rather than script requests
\_(ツ)_/
Monday, March 5, 2018 3:15 PM -
Sorry for posting in the wrong section, this is my first time seeking help. I'll delete this and try to find the proper section.Monday, March 5, 2018 3:30 PM
-
The forum is for technical people who actively use scripting. For script repair or changes you will need to contact a technician in you organization or a consultant.
Sorry.
\_(ツ)_/
- Proposed as answer by I.T Delinquent Monday, March 5, 2018 3:45 PM
Monday, March 5, 2018 3:34 PM