• Microsoft Exchange Server 2007 – Public Folders

    Some powershell stuff on managing Public Folders in Exchange 2007

    Create Public Folder

       New-PublicFolder -name "Name"

    Remove a Public Folder

       Remove-PublicFolder -Identity "My Public Folder"

    Get information on Public Folders

       Get-PublicFolder or Get-PublicFolder -Identity ""

    Get information on all public folders

       Get-PublicFolder -Recurse | Format-List Name

    get info on all system folders (not otherwise visible)

       Get-PublicFolder -Identity NON_IPM_SUBTREE -Recurse | Format-List Name 

    What I need to find out:

    – I could not find how to create a Contacts och Calendar Folder
    – I could not find out how to change permissions on the root of the Public Folder tree
    – I could not change the permission on the public folders

    Links:

    http://technet.microsoft.com/en-us/library/bb124411.aspx
    http://www.msexchange.org/tutorials/MF018.html

  • Microsoft Exchange Server 2007 – Connectors

    I recently installed my first Exchange 2007 Server and I had problems with recieving mail and found it to be related to the recieve connector.

    Exchange 2007 have two kinds of connector. Send connector and recieve connector.

    The send connector is located on the Organisation Level and you need to create one for the servers to be able to send mail to internet.

    The recieve connector is located in the server level. The Default Recieve Connector is automatically created.

    Note: By default it is set up to only recieve mail from authenticated servers. This is a problem if the server is connected directly to the internet. To fix this open properties for the Default Connector and go to “Permission Groups” and click “Anonymous Users” or use Powershell:

       set-ReceiveConnector -identity “Name of Default Connector” -PermissionGroups AnonymousUsers

    Links:

    http://technet.microsoft.com/en-us/library/bb125128.aspx
    http://www.robichaux.net/blog/2006/09/receiving_internet_email_with_exchange_2.php
    http://www.exchangepedia.com/blog/2006/07/exchange-server-2007-internet-email.html
    http://www.exchangeninjas.com/TUPMServerResponses

  • Scripting Exchange 2007

    As you know Exchange 2007 can be totally administered by using Powerscript. Here I have tried to collect some scripts for Exchange 2007 administration:

    Empty a mailbox database

    List mailbox servers in an organisation

       get-mailboxserver

    List maildatabases on current server

       get-mailboxdatabase

    List mailboxes in maildatabase

       get-mailbox -database "Mailbox Database"

    Disable a mailbox

       disable-mailbox [mailboxid]

    Bulk enable mailboxes for AD users:

    selects all users from AD

       get-user | where-object{$_.RecipientType –eq “User”}

    Selects all users from the OU people

       get-user –organizationalUnit people | where-object{$_.RecipientType –eq “User”}
       get-user -organizationalUnit domain/OU/SUBOU | where-object{$_.RecipientType -eq "User"}

       Note: This will get you only users NOT users with mailboxes

    Mailenable users from CSV file

       Import-CSV import.csv | foreach {enable-mailbox -Identity $_.Fullname -database EXCHSERVERMailbox Database"}

    Where the importfile looks like this:

    FullName,
    Firstname Lastname, Change Booking Policy for resources
    Set-MailboxCalendarSettings -Identity "Resource Name" -BookingWindowInDays 520

     

    Related Links

    http://exchangepedia.com/blog/2006/12/id-written-about-how-to-bulk-create.html
    http://dmitrysotnikov.wordpress.com/2007/05/04/ou-management-with-powershell/
    http://msexchangeteam.com/archive/2006/09/05/428833.aspx

  • Microsoft Exchange Server 2007 Installation Issues

    – Domain not in Windows 2000 native mode or Higher

       Solution: Raised Domain functional Level

    – Domain Controller Pre Windows 2003

       Solution: Specified DC on install

       setup /mode:install /domaincontroller:DC2k3.company.com /roles:ht,ca,mb,mt /enablelegacyoutlook /Organizationname:Company

    – Missing Patches for Powershell and .NET Framework

       WindowsServer2003.WindowsXP-KB926139-x64-ENU.exe
       NDP20-KB926776-X64.exe

    – You do not have permissions to read the security descriptor on CN=Deleted Objects,CN=Configuration,…

       Started installation from console instead of RDP Session

    Links:

    Common Mistakes When Upgrading Exchange 2000/2003 To a Exchange 2007
    Google Groups
    Jim McBee’s Mostly Exchange Web Log
    HELO Windows Blog
    Microsoft Technet Forum

  • Creating home directories

    Here is a short script for adding home directories for a user. You can use it in two different ways:

    1. Interactive

    homedir.bat username

    2. Batch

    homedir.bat -file userfile.txt

    Format for import file (userfile.txt):

    user1
    user2
    .
    .

    ======================= START SCRIPT ===========================
    @ECHO OFF
    if “%1″==”-file” GOTO FILE
    GOTO ADDHOMEDIR

    :FILE
    if “%2″==”” GOTO NOFILE
    Echo Reading from users from %2…
    for /f “tokens=*” %%a in (%2) do call :ADDHOMEDIR %%a

    goto :EXIT

    GOTO EXIT

    :ADDHOMEDIR

    IF NOT EXIST d:users%1 md d:users%1

    cacls d:users%1 /E /T /C /G “DOMAIN%1”:F “DOMAINDomain Admins”:F
    chown -r -v -d DOMAIN %1 d:users%1*

    GOTO EXIT

    :ERROR
    echo Folder already exists…
    GOTO EXIT

    :NOFILE

    echo Filename missing…
    GOTO EXIT

    :EXIT
    ======================= END SCRIPT ===========================

  • Use Ip in a batch script

    IPCONFIG |FIND “IP” > %temp%TEMPIP.txt
    FOR /F “tokens=2 delims=:” %%a in (%temp%TEMPIP.txt) do set IP=%%a
    del %temp%TEMPIP.txt
    set IP=%IP:~1%
    echo %IP% >%temp%ip.txt
    echo The current IP address is “%IP%”

  • How to perform a silent installation of the Backup Exec Desktop and Laptop Option (DLO) agent

    For a silent DLO installation on a Backup Exec media server, modify the following file:
    c:Program FilesVERITASBackup ExecNTAgentsDLOsetup.ini
    Note: The path will vary if Backup Exec is not installed to the default location on the media server.
    1. Open the file setup.ini.
    2. Change the following line from:
    CmdLine=/qf DEFAULTMEDIASERVER="SERVERNAME" LAUNCHCLIENT="1" /l*v "%TEMP%DLOAgentInstall.log"

    to:
    CmdLine=/qn DEFAULTMEDIASERVER="SERVERNAME" LAUNCHCLIENT="0" /l*v "%TEMP%DLOAgentInstall.log"
    3. Save the file.
    Descriptions
     

    Command Description
    /qn Silent install switch
    DEFAULTMEDIASERVER=”SERVERNAME” The name of your Media server (replacing SERVERNAME with the name / IP address of your Media server
    “%TEMP%DLOAgentInstall.log” Location in which the installation log file will be saved
    LAUNCHCLIENT=”0″ Choose whether to bring up the program interface during the installation

    After making this change, setup.exe can be run from the DLOAgent Share folder from the media server while on the client PC, or a script can be used to do this.
    Additional information:
    It has been observed that setup does not pick up the information in setup.ini with some third party applications that may be used to deploy this package using a script.   In such cases, setup.ini can be forced to be used by adding the following command to the batch file:
    “setup.exe /settings setup.ini”.
    It is advisable to create a customized setup.ini file, instead of modifying the original setup.ini so that too many changes are not made to the original file.
  • Uninstalling software from the command-line

    Sometimes you have the need for removing software from the command-line… for instance from a batch file or locin script.

    The easiest way is using msiexec.exe.

    Example (removing McAfee Virusscan 7.1):

          msiexec.exe /x C:Program FilesNetwork AssociatesVirusScanRepairCachevse710.msi /q

    This uses the msi packet to delete the software

          msiexec.exe /x {59224777-298D-4E9C-9AEB-4A91BDA01B27} /q

    and this uses the guid.

    The GUID can be found using regedit at:

          HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionUninstall

  • Scripting Cisco VPN connection

    The other day I had a computer that needed to automatically connect a VPN tunner on startup. Apparenty the Cisco VPN Client 4.6 and later has a Command-Line Interface so this can be done using this line in a batch-file.

             start /wait vpnclient.exe connect VPN-Profile user username pwd password

    It has a couple of other CLI-Switches:

             Cisco Systems VPN Client Version 4.7.00.0533
             Copyright (C) 1998-2005 Cisco Systems, Inc. All Rights Reserved.
             Client Type(s): Windows, WinNT
             Running on: 5.1.2600 Service Pack 2
             Config file directory: C:Program FilesCisco SystemsVPN Client

             Usage:
              vpnclient connect <profile> [user <username>] [eraseuserpwd | pwd <password>]
                                          [nocertpwd] [cliauth] [stdin] [sd]
              vpnclient disconnect
              vpnclient stat [reset] [traffic] [tunnel] [route] [firewall] [repeat]
              vpnclient notify
              vpnclient verify [autoinitconfig]
              vpnclient suspendfw
              vpnclient resumefw

  • kix32.exe is not recognized as an internal or external command

    Question: I get kix32.exe is not recognized as an internal or external command when I am trying to call kix32.exe in a batch file logon script.

    Answer: Try this %0..kix32.exe %0..script.scr