Saturday, 18 February 2012

Remotely Starting Services Using Powershell

Remotely Starting Service Using PowerShell


  1. You have to run this script as Privileged user or as Administrator
  2. Your administrator should have allowed remote execution of script on the target machine


This is just a sample of starting Spooler Service on a remote machine


$computername = "XXX3AZYYY"
$c = Get-Credential -Credential "domain\AdminUsername"
$m = Get-WmiObject -Class Win32_Service -ComputerName $computername  -Credential $c -Filter "Name='spooler'"
$m.StartService()


Exchange 2007 Offline Database Maintenance


  1. Before even thinking about beginning this process MAKE sure to have a backup of your database that you are going to defragment!
  2. Login as Exchange Administrator.
  3. Open Exchange management console.
  4. go to Server Configuration>Mailbox
  5. Select the server you want to view>expand the storage group that contains your database you want to run maintenance on.
  6. Highlight the database path and hit cntrl+c this will copy the path for later use
  7. In the action pane dismount the database
  8. open command prompt.
  9. switch to the directory where your database is located C:\program files\microsoft\exchange server\bin
  10. type isinteg.exe -s <servername> -test allfoldertests – this will display all of the database files
  11. type the corresponding number to run offline maintenance followed by Y for yes to confirm
  12. Keep running this utility until all of the errors are cleaned up
  13. At the command prompt to perform a database level integrity check run the following command – Eseutil /g “database file path”
  14. Once this is done free of errors defrag the database by running – Eseutil.exe /d “database file path”
  15. Once step 14 is complete go back into the Exchange Management console to mount the database