Databases Reference
In-Depth Information
$params["StartName"] = [String] "LocalSystem"
# Apply the Change method to the SQL Server service object
$result = $service.psbase.InvokeMethod('Change', $params, $Null)
"The return code of the Change method is " + $result["ReturnValue"]
To verify that the service account has been changed, run the following command:
Get-WmiObject -class Win32_Service | Where-Object{ ($_.Name -like 'MSSQLSERVER') } |
select StartName
Figure 8-23 shows that the SQL Server service account has been changed to LocalSystem.
Figure 8-23
Working with Processes
The Win32 Process class represents processes on an operating system. To get a list of processes on your
local computer, run the following command:
Get-WmiObject -class Win32_Process
There are many properties associated with each process. Some of the properties are static and don't
change after the process starts, such as those that provide the process identifier, the underlying binary
file, and the operating system of the process. Following is a list of static properties:
Caption : Contains a short description of the process
CommandLine : Contains the command line used to start a specific process. For example,
for the SQL Server service for the default instance installed in the default directory, it is
C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Binn\sqlservr.exe.
-sMSSQLSERVER .
CreationDate : Contains the date the process begins executing.
CSName : Contains the name of the computer system on which the process is running.
Description : Contains a detailed description of the process, if available.
ExecutablePath : Contains the path to the executable file of the process. It doesn't include the
parameters used to start the process.
Search WWH ::




Custom Search