This is the boiler plate code to create user profile. This is pretty useful when you are creating bulk users for a test environment.

Add-PSSnapin "Microsoft.SharePoint.PowerShell"
$site = "http://myweb"
$context = Get-SPServiceContext -Site $site
$web = Get-SPWeb -Identity $site
$group = $web.Groups["Owners"]
$upm = New-Object -TypeName Microsoft.Office.Server.UserProfiles.UserProfileManager -ArgumentList $context

$userslist = Import-Csv -Path .\UserProfile.csv
for($count=0; $count -lt $userslist.Count; $count++)

#Create User Profile
$profileproperty = $upm.GetUserProfile($userslist[$count].UserName)

#Custom User Profile being updated for the user
$profileproperty["Location"].Value = $userslist[$count].Location
$profileproperty["BusinessGroup"].Value = $userslist[$count].BusinessGroup


#Adding users to the owner groups of the site


The script is useful to add user in bulk. It assumes that the users are already created in AD. It reads a CSV file for the users and custom properties are updated..Though user profile can be synchronized with AD

UserName | Location | BusinessGroup