How to Change Startup Parameters in Powershell?

# Step 1 - create an object instance at the server level
PS SQLSERVER:\SQL\XU-ACER-PC> $a=new-object("Microsoft.sqlserver.management.smo.wmi.managedcomputer")
PS SQLSERVER:\SQL\XU-ACER-PC> $a

# Step 2 - Find all of the SQL Server Services on the server
PS SQLSERVER:\SQL\XU-ACER-PC> $a.services

# Step 3 - Find the sql server service
PS SQLSERVER:\SQL\XU-ACER-PC> $b=$a.services| ? {$_.Name -eq "mssqlserver"}
PS SQLSERVER:\SQL\XU-ACER-PC> $b

# Step 4 - check all startup parameters
PS SQLSERVER:\SQL\XU-ACER-PC> $b.StartupParameters
<#
-dC:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\master.mdf;-eC:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Log\ERRORLOG;-lC
:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\mastlog.ldf
#>

# Step 5 - change the startup parameters
PS SQLSERVER:\SQL\XU-ACER-PC> $b.StartupParameters ="-dC:\YourNewPath\master.mdf; -eC:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Log\ERRORLOG;-lC
:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\mastlog.ldf"

PS SQLSERVER:\SQL\XU-ACER-PC> $b.Alter() # do not forget this.