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 
 
 
 
                                                                      

Tuesday 26 November 2013

Getting service status on Local and remote servers

If you want to know the status of Particular service on local and Remote Servers use below Powershell cmdlets

On Local
PS C:\> Get-Service -Name spooler
Status   Name               DisplayName
------   ----               -----------
Running  spooler            Print Spooler
for remote servers

 PS C:\> Get-Service -Name spooler -ComputerName INDDC
Status   Name               DisplayName
------   ----               -----------
Running  spooler            Print Spooler

Wednesday 30 October 2013

some time system admin need to disable or change the start up type of some important services on windows.If the windows Machines  are less than 10 we can manage but what will be if the count is more than 100?


Set-Service -Name "W32Time" -StartupType "disabled" -ComputerName (Get-Content C:\Computers.txt)

where computers.txt contains list of servers which we need to disable service..

It helps in saving lot of time..


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...