Posts tagged PowerShell
Cannot process argument because the value of argument “name” is invalid
I was trying to read a CSV file with Powershell, with the command
1 |
$data = import-csv "C:\Sharepoint.csv") |
but I Kept getting the error :
1 2 |
Import-Csv : Cannot process argument because the value of argument "name" is invalid. Change the value of the "name" argument and run the operation again. |
I messed around with the “path” of the Import-CSV command but I just couldn’t make it work. Apparently this has nothing to do with the path of the CSV file. The Warlock posted this on his blog:
Long story short, the error came from having trailing blank columns in my CSV. Import-Csv uses the first row in the CSV as names for the columns (unless you specify otherwise) and when you have blank columns (or at least multiple blank columns) it causes this error as it doesn’t have a valid name for them
Instead of changing the file, I changed my import command to include the headers as per Dales Comment and it worked perfect:
1 |
"$data = import-csv "C:\Sharepoint.csv" -header("Department","AD Group","Members","Notes")" |
The Warlock and Dale saved me lots of time, please stop by the Warlock’s blog and give them a big “Thanks”
Deleting Application Pools from Sharepoint 2010
If like me you find youself with a bunch of orphaned application pools in your sharepoint server (trying to set up User Profile Sync) and you want to delete them, you will need these steps:
Open up the Sharepoint 2010 Management Shell
1 |
PS C:\Users\sharepoint> Get-SPServiceApplicationPool | select Name |
You should get results similar to this:
1 2 3 4 5 6 |
Name ---- UPS App Pool SecurityTokenServiceApplicationPool SharePoint Web Services Default SharePoint Web Services System |
Now issue the Remove Command
1 |
PS C:\Users\Sharepoint> Remove-SPServiceApplicationPool -Identity "UPS App Pool" |
You will get prompted to confirm
1 2 3 4 5 6 |
Confirm Are you sure you want to perform this action? Performing operation "Remove-SPServiceApplicationPool" on Target "SPIisWebServiceApplicationPool Name=UPS App Pool". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):Y |
Done.
Good bye App Pool