tag:blogger.com,1999:blog-68727615434643632172024-03-19T23:36:22.246-07:00Identifying what I am capable ofSatheeskumar A Shttp://www.blogger.com/profile/01166416553433875565noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-6872761543464363217.post-62104592461285522932016-09-21T00:05:00.000-07:002016-09-21T00:06:16.546-07:00Managing a Windows Service using PS<div dir="ltr" style="text-align: left;" trbidi="on">
<h3 style="text-align: left;">
Basic</h3>
Administrators can control all Windows Services in their domain using PowerShell.<br />
<br />
<b><span style="color: #cc0000;">Get-Service</span></b> is the most common cmdlet.<br />
<br />
The basic <b>Get-Service</b> with no parameters shows all services on the local computer.<br />
<br />
<div class="separator" style="clear: both; text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0t8ql_A7Cjper380Aoina3zfnI62j4fsSYREES1erxJ0lBQP-b3OA4_oI7UmDJ_mXiZkiindulUoZaNmXooE84nBzR9gH1Pe_IDi0sLNgNcOBqAKvaLLV7paA3vjnEKwuttSIAOsTRYE/s1600/Blog.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="106" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0t8ql_A7Cjper380Aoina3zfnI62j4fsSYREES1erxJ0lBQP-b3OA4_oI7UmDJ_mXiZkiindulUoZaNmXooE84nBzR9gH1Pe_IDi0sLNgNcOBqAKvaLLV7paA3vjnEKwuttSIAOsTRYE/s320/Blog.PNG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
But most administrators will need to find services on remote computers. This can be done with the <b>ComputerName</b> parameter</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<b><span style="color: red;">Get-Service -ComputerName Sathees-PC</span></b></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNxraomDoLbXmOwYqcfMgj9BMTfjUtk6wLxrxfEiCbcuQ8_oMFEE9E4xfZ9_N-5YV6Awacdn9bq_zIskx_zm0wWqsvoZJ1HNJr36Bn43tUxybueVSikuPiTW9wAWpdXKjgeDygRgrrJWU/s1600/02.PNG" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="107" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNxraomDoLbXmOwYqcfMgj9BMTfjUtk6wLxrxfEiCbcuQ8_oMFEE9E4xfZ9_N-5YV6Awacdn9bq_zIskx_zm0wWqsvoZJ1HNJr36Bn43tUxybueVSikuPiTW9wAWpdXKjgeDygRgrrJWU/s320/02.PNG" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><br /></td></tr>
</tbody></table>
<h3 style="clear: both; text-align: left;">
Multiple Computers</h3>
<div class="separator" style="clear: both; text-align: left;">
What if you want to see the services on multiple computers? Powershell has a cmdlet Get-Content that can read a text file which has computers names and by using a foreach loop, we can run Get-Service for each of those computers names.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: red;"><b>Get-Content C:Script\Computers.txt | foreach {Get-Service -ComputerName $_}</b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: red;"><b><br /></b></span></div>
<h3 style="clear: both; text-align: left;">
<b>Changing a Computer's Service with PS</b></h3>
<div>
Let's get a little deeper and change some of the services. For example, let's start the Application Layer Gateway service on all computers in that text file. By specifying a particular service to find and then piping that object to <b>Restart-Service.</b></div>
<div>
<b><br /></b></div>
<div>
<b style="color: red;">Get-Content C:Script\Computers.txt | foreach {Get-Service -ComputerName $_ -Name ALG | Restart Service}</b></div>
<div>
<b style="color: red;"><br /></b></div>
<div>
Hope, You will not get any Red text from PS output.</div>
<div>
<br /></div>
<div>
The output can be viewed using below command.</div>
<div>
<br /></div>
<div>
<b style="color: red;">Get-Content C:Script\Computers.txt | foreach {Get-Service -ComputerName $_ -Name ALG}</b></div>
<div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7l1Ih0lpbzw2ptdMM6qGeGNxLMwgN8SJs-9iVFo20mCKzC1BNYHpxlnpYgaRuUAqbTkaAOCawnR-R4u2mCHR6NKZHp4xV2vHymchPArGQ9jL5aAkXKrNRqG4DaqfpfOoR3iiZ1t9CMko/s1600/03.PNG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="38" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7l1Ih0lpbzw2ptdMM6qGeGNxLMwgN8SJs-9iVFo20mCKzC1BNYHpxlnpYgaRuUAqbTkaAOCawnR-R4u2mCHR6NKZHp4xV2vHymchPArGQ9jL5aAkXKrNRqG4DaqfpfOoR3iiZ1t9CMko/s400/03.PNG" width="400" /></a></div>
</div>
<br />
<br />
<br />
<br />
Ref link: <a href="http://searchwindowsserver.techtarget.com/tip/How-to-manage-Windows-services-using-PowerShell?utm_content=recipe6&utm_medium=EM&asrc=EM_ERU_63634000&utm_campaign=20160901_ERU%20Transmission%20for%2009/01/2016%20(UserUniverse:%202169787)_myka-reports@techtarget.com&utm_source=ERU&src=5549117">here</a></div>
Satheeskumar A Shttp://www.blogger.com/profile/01166416553433875565noreply@blogger.com0tag:blogger.com,1999:blog-6872761543464363217.post-86567943916464903912016-05-12T23:27:00.001-07:002016-05-12T23:30:38.623-07:00Ways to identify a Virtual Machine<div dir="ltr" style="text-align: left;" trbidi="on">
<h4 style="text-align: left;">
01. Using MSINFO32</h4>
<div>
<br /></div>
<div>
Open Run Command and type in msinfo32, The System Model from list specifies whether a Machine is VM or Physical.</div>
<div>
<br /></div>
<div>
If its VM then the value will be </div>
<div>
<br /></div>
<div>
<b>System Model : Virtual Machine </b></div>
<div>
<br /></div>
<div>
If its Physical then the value will be</div>
<div>
<br /></div>
<div>
System Model : Manufacture Model Name</div>
<div>
<br /></div>
<h4 style="text-align: left;">
02. Using Powershell Script</h4>
<div>
<br /></div>
<div>
Run the below Powershell command from elevated permission</div>
<div>
<b><br /></b></div>
<div>
<b>Systeminfo | findstr /i model</b></div>
</div>
Satheeskumar A Shttp://www.blogger.com/profile/01166416553433875565noreply@blogger.com0tag:blogger.com,1999:blog-6872761543464363217.post-88650562010302477622016-05-05T21:45:00.004-07:002016-05-05T21:45:45.386-07:00Identifying Hyper-V Virtual Host of a VM<div dir="ltr" style="text-align: left;" trbidi="on">
Recently I came across to manage the Virtual Space for the VMs which are running out of space. I had to identify Virtual Host's free space before trying to expand the VHD size as Hyper-V allows to expand it.<br />
<br />
You can identify the Hyper-V host name in the guest VM's Registry at the following key:<br />
<h4 style="text-align: left;">
<br />HKLM\Software\Microsoft\Virtual Machine\Guest\Parameters</h4>
<br />
Dword <b>HostName</b> should reflect your Hyper-V Host Name where the VM is hosted.<br />
<br />
If you feel lazy to get deep into Registry, run the below command from Powershell (I prefer Run as administrator). It works on Windows Server 2008 and higher<br />
<br />
<h4 style="text-align: left;">
PS C:\Windows\System32> (get-item "HKLM:\Software\Microsoft\Virtual Machines\Guest\Parameters").GetValue("HostName")</h4>
</div>
Satheeskumar A Shttp://www.blogger.com/profile/01166416553433875565noreply@blogger.com0tag:blogger.com,1999:blog-6872761543464363217.post-19158043888846890282016-05-04T23:13:00.000-07:002016-05-04T23:15:32.788-07:00It's me<div dir="ltr" style="text-align: left;" trbidi="on">
<h3 style="text-align: left;">
<b><span class="Apple-style-span" style="color: red;">Introduction</span></b></h3>
I am writing this, because I need a change in my regular life<br />
I am writing this, because I am a lazy person that I want to get rid-off<br />
I am writing this, because I want to come out of something which I liked so much<br />
I am writing this, because I want to forget which keeps me floating away from the normal life<br />
I am writing this, because I want to learn writing and speaking<br />
I am writing this, because I am confused. :)<br />
<br /></div>
Satheeskumar A Shttp://www.blogger.com/profile/01166416553433875565noreply@blogger.com0