Sunday 22 December 2013

How to stop or start a specifc service on local as well on remote systems

This time I am posting Powershell Script on How to stop or start  a specifc service on local as well on remote systems

 

Get-Service -Name w32time
 
Output
 
PS C:\Users\administrator> Get-Service -Name w32time
Status   Name               DisplayName                          
------   ----               -----------                          
Running  w32time            Windows Time       

 
For stopping
 
Get-Service -Name w32time | Stop-Service
 
checking for Status

 PS C:\Users\administrator> Get-Service -Name w32time

Status   Name               DisplayName                          
------   ----               -----------                          
Stopped  w32time            Windows Time
                         


For Bulk of servers This time we are doing stopping as well Disabling the service




$computers = Get-Content C:\servers.txt

ForEach ($computer in $computers)

{

  
      Stop-Service -InputObject $(Get-Service -Computer $computer -Name w32time);
 Set-Service  -StartupType "Disabled" -InputObject $(Get-Service -Computer $computer -Name w32time);

   
}



 

Tuesday 17 December 2013

Getting Serial number for local system and Remote systems

Friends today i have posted a new article for getting serial number for local and remote systems

Well this is very helpful for System administrators who are maintaining the Inventory.

On local system

Get-WmiObject win32_bios | Select-Object __server,serialnumber


__SERVER                                                                                    serialnumber                                                                              

--------                                                                                    ------------                                                                             

CORESHELL                                                                                   AWCCHDNA056JJI          
 

Geeting Serial numbers for list of servers.

 
Get-WmiObject win32_bios -ComputerName (Get-Content C:\servers.txt)| Select-Object __server,Serialnumber
CORESHELL                                                                                   AWCCHDNA056JJI          
NODE1                                                                                       VMware-56 4d 56 6a 4e 70 d3 38-5e b0 01
INDDC                                                                                       VMware-56 4d 4b 6e 9f 8a 12 17-ae c6 20 02
NODE2                                                                                       VMware-56 4d 4c fa 0f 4b ef 42-2b 5e 38 9e
 
where servers.txt contains list of servernames 
 
 
 
                                                                      

Powershell function to get theremote server IP details,Subnetmask,Gateway,DHCP Enabled status,DNS Servers,Wins and Macaddress

#Powershell function to get theremote server IP details,Subnetmask,Gateway,DHCP Enabled status,DNS Servers,Wins and Macaddress # use...