run sql server unattended setup on remote host using powershell

  • running

    Enter-PSSession -ComputerName MyServer001 -Credential pricing\dba

    connected at

    [MyServer001]: PS C:\Users\dba\Documents>

    "for clear post I placed setup params on separate line, in my call params on same line"

    trying to run

    [MyServer001]: PS C:\Users\dba\Documents>\\myserver123\microsoft\mssql\2014\Ent\Setup.exe

    /Q

    /ACTION=Install

    /IACCEPTSQLSERVERLICENSETERMS

    /FEATURES=SQL, Tools

    /INSTANCENAME="S999"

    /AGTSVCACCOUNT="pricing\dba"

    /AGTSVCPASSWORD='mypass'

    /SAPWD="AAA_sa"

    /SECURITYMODE=SQL

    /SQLSVCACCOUNT="pricing\svcsql"

    /SQLSVCPASSWORD="1234"

    /SQLSYSADMINACCOUNTS="pricing\svcsql" "pricing\dba"

    getting error

    powershell.exe : The term '\\myserver123\microsoft\mssql\2014\Ent\Setup.exe' is

    + CategoryInfo : NotSpecified: (The term '\\mys...\Setup.exe' is :String) [], RemoteException

    + FullyQualifiedErrorId : NativeCommandError

    not recognized as the name of a cmdlet, function, script file, or operable prog

    ram. Check the spelling of the name, or if a path was included, verify that the

    path is correct and try again.

    also tried to test if my connection can see the shared file

    [MyServer001]: PS C:\Users\dba\Documents>cd \\myserver123\microsoft\mssql\2014\Ent

    Set-Location : Cannot find path '\\myserver123\microsoft\mssql\2014\Ent' because it does not exist.

    + CategoryInfo : ObjectNotFound: (\\myserver123\...oft\mssql\2014\:String) [Set-Location], ItemNotFound

    xception

    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand

    Question

    How correctly run remote unattended sql setup using powershell?

  • Unless I am misreading this, you cannot access that executable (Setup.exe) from the PowerShell runspace. If you cannot access the file using get-item the it is likely a security access permission or path existence issue.

    Try again once you are certain that you both access and execute the file.

    Gaz

    -- Stop your grinnin' and drop your linen...they're everywhere!!!

  • Hi,

    Additionally to Gary Varga's reply, and if the issue persists, please check if the issue is not related with the firewall(s), you can check this by simply using the command TELNET in cmd like this:

    TELNET myserver123 445

    If you cmd window gets all empty (no text visible), it means that the firewalls are correctly set up, if you get something like this "Connecting To myserver123...Could not open connection to the host, on port 445:

    Connect failed" it means that you have to check the firewall in both servers: MyServer001 and myserver123, and in the case that if any switch/router has a firewall, check with your network administrators if the connection from server one to server two on the port 445 TCP is allowed.

    Regards.

  • Also, to add to previous posts, something that has tripped me up before when using UNC paths. Powershell cmdlets can attempt to resolving the UNC path to registry location instead of a filesystem object.

    So after being bitten by this quirk, I always prefix UNC paths with FileSystem:: which will force the cmdlet to use the FileSystem provider.

    eg: Get-ChildItem FileSystem::"\\MyServer\MyShare\"

    --------------------
    Colt 45 - the original point and click interface

  • philcart (9/1/2016)


    Also, to add to previous posts, something that has tripped me up before when using UNC paths. Powershell cmdlets can attempt to resolving the UNC path to registry location instead of a filesystem object.

    So after being bitten by this quirk, I always prefix UNC paths with FileSystem:: which will force the cmdlet to use the FileSystem provider.

    eg: Get-ChildItem FileSystem::"\\MyServer\MyShare\"

    Woah there Leslie!!!

    Thanks Phil. I haven't come across that before (that I know of) but I bet I will in future!!!

    Gaz

    -- Stop your grinnin' and drop your linen...they're everywhere!!!

  • Gary Varga (9/1/2016)


    philcart (9/1/2016)


    Also, to add to previous posts, something that has tripped me up before when using UNC paths. Powershell cmdlets can attempt to resolving the UNC path to registry location instead of a filesystem object.

    So after being bitten by this quirk, I always prefix UNC paths with FileSystem:: which will force the cmdlet to use the FileSystem provider.

    eg: Get-ChildItem FileSystem::"\\MyServer\MyShare\"

    Woah there Leslie!!!

    Thanks Phil. I haven't come across that before (that I know of) but I bet I will in future!!!

    Gary, I think it's something to do with a UNC path not being homed to a PSDrive.

    --------------------
    Colt 45 - the original point and click interface

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply