SharePoint PowerShell from 20331 and 20332
Managed Metadata
New-ADUser -SamAccountName SPSalesMMS -Name "SharePoint Sales MMS" -UserPrincipalName "SPSalesMMS@contoso.com" -AccountPassword (Read-host “enter password” -AsSecureString) -Path “OU=SharePoint,DC=Contoso,DC=com” -Enabled $true -PasswordNeverExpires $true -ChangePasswordAtLogon $false
New-SPManagedAccount
$AppPool = New-SPServiceApplicationPool -Name ContosoSalesMMSAppPool -Account SPSalesMMS@contoso.com
$MMS = New-SPMetadataServiceApplication -Name "Contoso Sales Managed Metadata" -ApplicationPool $AppPool -DatabaseName ContosoSalesMMS -HubUri http://sales.contoso.com
New-SPMetadataServiceApplicationProxy -Name "Contoso Sales Managed Metadata" -ServiceApplication $MMS –DefaultProxyGroup
State Service
$serviceApp = New-SPStateServiceApplication -Name "StateService-App"
New-SPStateServiceDatabase -Name "SS-Database" -ServiceApplication $serviceApp
New-SPStateServiceApplicationProxy -Name "StateService-App" -ServiceApplication $serviceApp -DefaultProxyGroup