Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have seen the following as a suggestion to create home directory for a user. So I have tried the following script to create a home directory :

 $sec_password = ConvertTo-SecureString 'Connector123' -AsPlainText -Force;
$credential = New-Object System.Management.Automation.PSCredential -ArgumentList 'BLR2202710\Administrator', $sec_password;
Start-Process cmd /c -WindowStyle Hidden -Credential $credential -ErrorAction SilentlyContinue;  
$user = Get-WmiObject -Namespace root/cimv2 -Class win32_useraccount -Filter "LocalAccount=True AND Name='account17'";
$userprofile = Get-WmiObject -Namespace root/cimv2 -Class win32_userprofile -Filter "SID='$($user.sid)' ";

But it fails with the following exception : 'Parameter set cannot be resolved using the specified named parameters. + CategoryInfo : InvalidArgument: (:) [Start-Process], ParameterBindingException + FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.PowerShell.Commands.StartProcessCommand'

I am getting the issue in

Start-Process cmd /c -WindowStyle Hidden -Wait -Credential $credential    
    -ErrorAction SilentlyContinue;  
share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.