Its and windows machine and trying to install Sql Server(unattended) using powershell



Write-Host "`nStarting the install of SQL Server" -ForegroundColor Green
    
[string]$userName = 'domain\username'
    
[string]$userPassword = 'xyz'
     
[securestring]$secStringPassword = ConvertTo-SecureString $userPassword -AsPlainText -Force
     
[pscredential]$credObject = New-Object System.Management.Automation.PSCredential ($userName, $secStringPassword)
   
Start-Process -Filepath "$driveLetter\setup.exe" -ArgumentList "/ConfigurationFile=`"$temp_file_location`"" -Credential $credObject -NoNewWindow -Wait -RedirectStandardOutput $standardOutputFile -RedirectStandardError $errorOutputFile 


ERROR:

PS C:\Windows\system32> C:\Users\manish\Desktop\custommain.ps1
domain
eu-west-1
fetching the password from parameter stores
Cleaning the outputfile error
finding and replacing the domains and secrets
writting the content of ini into temp file C:\xyz-softwares\ms-sql-server\scripts\batch-files\temp_ConfigurationFile.ini
Mounting SQL Server Image
Getting Disk drive of the mounted image
Starting the install of SQL Server
Start-Process : This command cannot be run due to the error: The user name or password is incorrect.
At C:\xyz-softwares\ms-sql-server\scripts\powershell\ms-sqlserver-installation.ps1:65 char:2
+     Start-Process -Filepath "$driveLetter\setup.exe" -ArgumentList "/ ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
SQL Installation Failed Installation with exit code
SQL Installation Failed Installation with exit code
At C:\xyz-softwares\ms-sql-server\scripts\powershell\ms-sqlserver-installation.ps1:72 char:9
+         throw $error_message
+         ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (SQL Installatio... with exit code:String) [], RuntimeException
    + FullyQualifiedErrorId : SQL Installation Failed Installation with exit code
PS C:\Windows\system32>

I have tried with powershell with domain credentials. Although i have exe file and windows machine is connected with domain

Tried to start process command with domain credetials.

0

There are 0 best solutions below