<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WMI Archives - DBAduck</title>
	<atom:link href="https://www.dbaduck.com/tag/wmi/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbaduck.com/tag/wmi/</link>
	<description>DBA</description>
	<lastBuildDate>Wed, 18 May 2022 18:48:06 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://www.dbaduck.com/wp-content/uploads/2013/12/cropped-dbaducklogo-2-32x32.png</url>
	<title>WMI Archives - DBAduck</title>
	<link>https://www.dbaduck.com/tag/wmi/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Get SQL Server Service Accounts with WMI</title>
		<link>https://www.dbaduck.com/get-sql-server-service-accounts-with-wmi/</link>
					<comments>https://www.dbaduck.com/get-sql-server-service-accounts-with-wmi/#comments</comments>
		
		<dc:creator><![CDATA[dbaduck]]></dc:creator>
		<pubDate>Tue, 25 Sep 2012 15:57:05 +0000</pubDate>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[SMO]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[WMI]]></category>
		<guid isPermaLink="false">http://dbaduck.wpengine.com/?p=75</guid>

					<description><![CDATA[<p>Today I was tasked with retrieving the SQL Server Service accounts to validate them in Active Directory.&#160; I wanted a simple way to get them and show the account names for each SQL Server service.&#160; I knew that you could get the service in PowerShell with Get-Service.&#160; I also new that PowerShell could get the [&#8230;]</p>
<p>The post <a href="https://www.dbaduck.com/get-sql-server-service-accounts-with-wmi/">Get SQL Server Service Accounts with WMI</a> appeared first on <a href="https://www.dbaduck.com">DBAduck</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Today I was tasked with retrieving the <a href="http://www.microsoft.com/sql" target="_blank" rel="noopener noreferrer">SQL Server</a> Service accounts to validate them in Active Directory.&nbsp; I wanted a simple way to get them and show the account names for each SQL Server service.&nbsp; I knew that you could get the service in PowerShell with Get-Service.&nbsp; I also new that PowerShell could get the service with Get-WmiObject –class Win32_Service. But neither one had the ServiceAccount property.</p>
<p>So I turned to WMI under SMO with PowerShell.&nbsp; The script below has the details of a script I named GetSqlServices_WMI with a parameter of $sqlserver.</p>
<div id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:96c101c9-5c3d-4b20-a294-3801ec81c9c1" class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: none; padding: 0px;">
<pre class="urvanov-syntax-highlighter-plain-tag">param (
[string]$sqlserver
)
# Call this with .\filename.ps1 &quot;servername&quot;
[void][reflection.assembly]::LoadWithPartialName(&quot;Microsoft.SqlServer.SqlWmiManagement&quot;)
$wmi = New-Object -TypeName &quot;Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer&quot; -Args $sqlserver
$wmi.Services | Select DisplayName, Type, StartMode, ServiceState, ServiceAccount | ft -auto</pre>
</div>
<p>The call is in the code.&nbsp; The results will have DisplayName, Type, StartMode, ServiceState and ServiceAccount listed in a table with column headers.</p>
<p>Great way to interrogate the Services from SQL Server.</p>
<p>Available Properties to you are as follows:</p>
<ul>
<li>Parent</li>
<li>AcceptsPause</li>
<li>AcceptsStop</li>
<li>Description</li>
<li>DisplayName</li>
<li>ErrorControl</li>
<li>ExitCode</li>
<li>PathName</li>
<li>ProcessId</li>
<li>ServiceAccount</li>
<li>StartMode</li>
<li>Type</li>
<li>IsHadrEnabled (because I am using 11.0 SMO)</li>
<li>StartupParameters</li>
<li>Dependencies</li>
<li>AdvancedProperties</li>
<li>Urn</li>
<li>Name</li>
<li>Properties</li>
<li>UserData</li>
<li>State</li>
</ul>
<p>With Methods</p>
<ul>
<li>Alter</li>
<li>ChangeHadrServiceSetting (because I am using 11.0 SMO)</li>
<li>ChangePassword</li>
<li>Equals</li>
<li>GetHashCode</li>
<li>GetType</li>
<li>Initialize</li>
<li>Pause</li>
<li>Refresh</li>
<li>REsume</li>
<li>SetServiceAccount (handy little guy)</li>
<li>Start</li>
<li>STop</li>
<li>ToString</li>
<li>Validate</li>
</ul>
<p>The link to the documentation for this object is here (<a href="http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.wmi.managedcomputer%28v=sql.105%29.aspx" target="_blank" rel="noopener noreferrer">Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer</a>).</p>
<p>Enjoy and happy scripting.</p>
<p>@DBAduck</p>
<p>The post <a href="https://www.dbaduck.com/get-sql-server-service-accounts-with-wmi/">Get SQL Server Service Accounts with WMI</a> appeared first on <a href="https://www.dbaduck.com">DBAduck</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbaduck.com/get-sql-server-service-accounts-with-wmi/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
