Peter's IT Blog

Subscribe


My Library

Disclaimer:

DISCLAIMER: THIS BLOG SITE IS FOR MY OWN PERSONAL RECORD. PLEASE USE AT YOUR OWN RISK. I NOR MY EMPLOYERS/COMPANY WILL NOT BE HELD RESPONSIBLE FOR YOUR ACTION(S).
Peter's IT Blog

Monitoring Exchange Services on a Remote Server using Powershell and WMI

The purpose of this script is to monitor Exchange Services from a remote server, if any of the services failed then trigger an email alert using one of the present SMTP server. This requires that the SMTP server allow for anonymous relay for the specific IP address of the server that this script runs under. This script can be triggered as a scheduled task and send an alert to an Exchange Admin warning he/she that a service is down. An example of how this would be useful:

Let's say you have 2 edge servers (Server A and Server B ). You can ...<< MORE >>

Pruning Old Computer Accounts in AD

In an organization with large Active Directory (AD) database, it is a daunting task to manage the Directory Services and keep it clean from inactive or old computers account. By using the DSQUERY command, you can query AD for old computers account based on the specific time frame since it last reported to AD and remove them.

An example of using DSQUERY to do such task is:

dsquery computer -inactive 12 -limit 0

The output result would be a list of computers that have not reported to AD for the last 3 months or 12 weeks. You can then review the list and verify that ...<< MORE >>

Asterisk - VoIP Codecs

Below are a diffrent types of Codecs that Asterisk can handle

































Codec  Speed Simultaneous Calls over T1 (1.5 Mbps)   Notes 
 u-law  64 Kbps  24  US Standard
 a-law  64 Kbps  24  European standard
 G.723.1  5.3/6.3 Kbps  289/243  
 G.726  16/24/32/40 Kbps  96/64/48/38  
 G.729  8 Kbps  192  Requires license






















 GSM  13 Kbps   118  
 iLBC  15 Kbps   102  
 LPC-10  2.5 Kbps   614  
 Speex  2.15 - 44.2 Kbps     714 - 34                                                      Open Codec          

With higher compression you can squeeze more calls ...<< MORE >>

Creating bulk contacts in Exchange 2007 using Powershell

We needed to create a massive list of mail-enabled in Exchange. We needed a script that flexible enough to allow us to create contacts in multiple OUs, Different primary SMTP addresses, different External email addresses. So we came up with this script, the script operates on the input of a text file which tell it information such as the user's name, OU to create the contact in and their email addresses. The script will also override the Default Domain Email Address Policy, this means if you have a policy stating that ALL email contacts/users/mailboxes email addresses will have to follow a ...<< MORE >>

Building a Windows 2008 Server Core Domain Controller Step by Step

Below are the steps of configuring a Windows 2008 Server Core from scratch to a secondary Domain Controller To set the server with a static IP address 1. At a command prompt, type the following: netsh interface ipv4 show interfaces 2. Look at the number in the "Idx" column. Take note of the Idx number of the NIC that needed to be setup with the IP address 3. netsh interface ipv4 set address name="" source=static address= mask gateway= Where: = The Idx number noted in step 2. = The static IP address that needed to be assigned to the server = The subnet mask for the IP address = Default gateway's IP address To set the DNS server's IP address 1. netsh interface ipv4 add dnsserver name="" address= index=1 Where: = Idx number noted previously = IP address of the DNS Server 2. Repeat step 1 for each DNS server that needs to be added, incrementing index= by 1 each time3 To set hostname of the server: 1. At a command prompt type: hostname Notice the name of the machine is randomly generated during the install 2. To rename type: netdom renamecomputer %computername% /NewName 3. Reboot the machine: Shutdown -r -t 0 4. Verify new name is set by repeating step 1 Joining the server to a domain: 1. netdom join %computername% /domain: /userd: /passwordd:* 2. Reboot the server: Shutdown -r -t 0 Configuring firewall for RDP 1. netsh advfirewall set rule group="Remote Desktop" new enabled=yes Configuring RDP 1. cscript c:\windows\system32\SCregEdit.wsf /ar /v 2. Note the number presented. 1 = RDP disabled, 0 = enabled 3. To enable RDP: cscript c:\windows\system32\SCregEdit.wsf /ar 0 4. Test RDP to the server from a different machine Configuring WinRM (Windows Remote Management) for remote management via WinRS (Windows Remote Shell) 1. WinRM qc or WinRM quickconfig Verifying WinRM is configured: 1. winrm e winrm/config/listener Configuring Automatic Updates: 1. cscript c:\windows\system32\SCregEdit.wsf /au 4 Promoting to Domain Controller: 1. Creating an unattended installation file: At the command prompt type: notepad Enter the following: ;dcpromo.exe /unattend:c:\additionalDC.txt ;You may need to fill in password fields for true unattended installation ;If you leave the values for "Password" as * ;then you will be promted for credentials [DCInstall] ReplicaDomainDNSName=pnlab.local SiteName=Default-First-Site-Name InstallDNS=Yes ConfirmGC=yes Username:pnlab\pnguyen Password=* DatabasePath="C:\Windows\NTDS" LogPath="C:\Windows\NTDS" SYSVOLPath="C:\Windows\SYSVOL" SafeModeAdminPassword=* RebootOnCompletion=No Save file as c:\additionalDC.txt. For reference on creating unattended installation file go to: http://www.petri.co.il/creating-unattend-installation-file-dcpromo-windows-server-2008.htm 2. dcpromo /unattend:c:\AdditionalDC.txt 3. If there are no error, reboot the machine: shutdown -r -t 0 To activate the server: 1. slmgr.vbs -ato Note: to change the product key: start /w slmgr.vbs -ipk xxxxx-xxxxx-xxxxx-xxxxx-xxxxx start /w slmgr.vbs -ato 2. Verifying activation completed: start /w slmgr.vbs -dli Configuring Error reporting: 1. serverWerOptin /disable Options: disable, detailed, summary, query Confirm regional settings: 1. control timedate.cpl 2. control intl.cpl Log off the server: 1. Logoff << MORE >>

Monitoring & Notifying Status of Exchange Services using Powershell

For those who have more then one exchange server, i.e. Edge - Hub/Mailbox, you can use this script to monitor exchange services and if any of the services crashes and doesn't come up this can help monitor and send notification via emails. Next week I will blog about a similar script that allows for remote monitoring of these services using Powershell and WMI.

So the process involves creating the script below, and then schedule it to run every hour using the Windows Scheduler. Once this is set, the service will run locally on the machine, query itself to see if any of ...<< MORE >>

Making AD accounts in an OU "mail-enabled" using powershell

If you have a number of users in an OU that are not mail-enabled. You can use the following command to look for all users in a specific OU and then make them mail-enabled:

Get-User -OrganizationalUnit "pnlab.com/pnlab/users/needmailenabled" | Enable-Mailbox -Database "PNLAB storage group\mailbox database"

Explaination:
Get-User -OrganizationalUnit "pnlab.com/pnlab/users/needmailenabled" | lists all users in the pnlab.com domain, pnlab/users/needmailenabled OU and then pipe the results (line by line) into the next command

Enable-Mailbox -Database "PNLAB storage group\mailbox database" This command takes the output of the last command (Get-User) and mail-enable the AD account puting them into the "PNLAB storage group" storage group and "mailbox database" database.
...<< MORE >>

Creating multiple users using a batch file

This is probably an old topic but I'll blog it anyways in case someone might find it useful.

This article is about how to create a list of new users in a specific OU. So here are the requirements:

Users are required to change password at first log on
User accounts are enabled
Username would be the first initial + lastname
There will be a same default password assigned to all of the users

Steps:

Create a batch file with the following content

@echo off
cls
echo Creating Accounts
echo ------------------
for /f "tokens=1-3" %%A in (userlist.txt) do (dsadd user "CN=%%A,ou=Support,ou=IT,dc=thenguyen,dc=local" -fn %%B -ln %%C -display "%%B %%C" -upn %%A@thenguyen.local -pwd ...<< MORE >>

Installing Exchange 2007 Pre-requisites on Windows 2008 using command-line

Installing Exchange SP1 Pre-reqs on Windows 2008
Prereqs:
 
.NET Framework 2.0 or 3.0
Powershell
MMC 3.0 (Installed by default)
IIS 7.0 with various components
Unlike IIS 6 in Windows 2003, the version that comes with Windows 2008 are broken down into many different components that must be installed/selected individually during the installation process. You can install this through the Server Manager MMC using Roles or use a command line as described here.
 


NOTE: All server roles other than the Edge Transport server role must first join to the appropriate internal Active Directory forest and domain


Steps:


At the command prompt type:


ServerManagerCmd ...<< MORE >>

Parameter replacement during creation of the alert failed.

So we have SCOM scours through our Domain Controllers in event logs in Agentless mode to look for security event IDs such as account lockout, deletion, creation, etc. Recently, we ran into an issue where SCOM was throwing caution alerts in the monitor view of SCOM with the following description:

Parameter replacement during creation of the alert failed.


Alert: 73A482E1-631D-C63A-1D17-D563646BBD9B


Workflow: MomUIGeneratedRule800972be4c264006b51ebab11dface54


Instance: domaincontroller.domain.com


Instance ID: {7A857146-7E01-F125-C938-21D9B1F75114}


Management Group: MGMTGroup1


Failing replacement: $Data/Params/Param[8]$

After some poking around I decided that the only thing worth looking at is the Alert ID and the Workflow ID. After a googling for a bit ...<< MORE >>

Blog Software