Robocopy

To move files & folders from one location to another without security: robocopy <source_directory> <target_directory> /TEE /E /MOVE /R:2 /W:1 /LOG+:c:\LOG.txt To copy files & folders from one location to another with security: (to copy without security, don’t include /copyall) robocopy <source_directory> <target_directory> /copyall /E /B /R:2 /W:1 /LOG+:c:\LOG.txt /TEE To copy files & folders from one location to another without security, and eXclude "eXtra" files and directories (present in destination but not source): robocopy <source_directory> <target_directory> /e /b /r:2 /w:1 /XX /LOG+:c:\rcopy.log /TEE To copy only NTFS security permissions and no data to, and eXclude new, old or changed…

CSVDE & LDAP queries

To export information from Active Directory using CSVDE, LDAP queries are used with CSVDE. Also, LADP queries can be used in Active Directory (AD) Users and Computers, there’s a section at the top called Saved Queries. You can right click on Saved Queries to create a new Query > click Define Query > select Custom Search from the drop down list > click Advanced. LDAP queries can be added here. -r = LDAP search filter (Default to "(objectClass=*)") = (EQUAL TO) – This LDAP argument means a certain attribute must be equal to a certain value to be true. For…

Exchange 2007 PowerShell commands

Getting and Viewing data from Powershell When viewing information from the Exchange Management Shell, sometimes all the information is bunched up like this: Identity             User                 AccessRights        IsInherited Deny ——–             —-                 ————        ———– —- nativeconnections… NT AUTHORITY\SELF    {FullAccess, Rea… False       False nativeconnections… NATIVECONNECTIO\E… {ReadPermission}    True        False nativeconnections… NATIVECONNECTIO\E… {FullAccess}        True        True nativeconnections… NATIVECONNECTIO\D… {FullAccess}        True        True nativeconnections… NATIVECONNECTIO\E… {FullAccess}        True        True nativeconnections… NATIVECONNECTIO\E… {FullAccess}        True        True nativeconnections… NATIVECONNECTIO\A… {FullAccess}        True        True nativeconnections… NATIVECONNECTIO\s… {FullAccess}        True        True nativeconnections… NATIVECONNECTIO\E… {FullAccess}        True        False nativeconnections… NATIVECONNECTIO\E… {FullAccess}        True        False nativeconnections… NATIVECONNECTIO\E… {ReadPermission}    True        False nativeconnections… NATIVECONNECTIO\E… {ReadPermission}    True        False nativeconnections… NATIVECONNECTIO\E… {ReadPermission}    True        False…

Removing disconnected mailboxes in Exchange Server 2007

Exchange Server 2007 doesn’t allow us to purge the disconnected mailbox. In order to remove one or multiple disconnected mailboxes we can be performing these steps: Listing all disconnected mailboxes Get-MailboxStatistics | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid Removing a single entry Remove-Mailbox -Database <Database-Name> -StoreMailboxIdentity <MailboxGuid> -confirm:$false Removing all users at the same time $users = Get-MailboxStatistics | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid Now that we have all disconnected mailboxes in a var, we can run the following cmdlet to remove all of them: $users | ForEach { Remove-Mailbox -Database "Mailbox Database"…

Create Anonymous Relay for Exchange 2007

Setting up relay for Exchange 2007 is done on the Receive connector. It can be locked down to certain IP addresses & Users. Here’s an example, to setup a receive connector which allows connections from a list of specific IP addresses, on the Edge Transport server or Hub Transport server run the following command: New-ReceiveConnector –Name "Anonymous Relay" -Usage Custom -PermissionGroups AnonymousUsers, ExchangeServers -Bindings 0.0.0.0:25 –AuthMechanism Tls, ExternalAuthoritative -RemoteIpRanges 149.171.135.0/24, 149.171.130.128/26, 149.171.130.192/26, 149.171.131.75,149.171.131.81, 149.171.130.23, 149.71.70.0/24, 149.171.62.0/24, 149.171.130.32, 149.171.130.22, 129.94.41.94 PermissionGroups – AnonymousUsers, ExchangeUsers, ExchangeServers, LegacyExchangeServers, Partners Bindings – 0.0.0.0:25 AuthMechanism – Tls, ExternalAuthoritative   From the image above, ticking the…

Setup and remotely manage Microsoft Hyper-V Server 2008 – Workgroup environment

  To find the network adapters At a command prompt, type the following: netsh interface ipv4 show interfaces Make a note of the number shown in the Idx column of the output for your network adapter. If your computer has more than one network adapter, make a note of the number corresponding to the network adapter for which you wish to set a static IP address. Set the IP address At the command prompt, type: netsh interface ipv4 set address name="<ID>" source=static address=<StaticIP> mask=<SubnetMask> gateway=<DefaultGateway> Where: ID is the number from step 2 above StaticIP is the static IP address…

Windows Server 2008 – Deployment using Windows Deployment Services (WDS)

  For Windows Server 2008 deployment we will be using Windows Deployment Services installed on Windows 2003  – inftwsm005 (149.171.56.13) In a nutshell, on the Windows Server 2008 DVD media you can find two WIM files, boot.wim (PE image) and the other is install.wim (the actual operating systems). The boot.wim file is the very first PE GUI that you see which asks you all the questions including what OS you want to install and drive configuration before it starts to copy the files to the hard drive. The install.wim file contains 6 different versions of the operating system for the…

Creating your own Exchange 2007 SSL certificates to publish OWA, Outlook Anywhere & Active Sync with ISA 2006

On your Exchange CAS For Auto Discover New-ExchangeCertificate -GenerateRequest:$true -SubjectName "C=AU, O=Company, CN=autodiscover.externalname.com" -DomainName mail.externalname.com, autodiscover.externalname.com, exc2007.internalname.local, autodiscover.internalname.local -FriendlyName "Microsoft Exchange 2007" -Path c:\AutoDiscover_mailcert.req -privatekeyexportable:$true For OWA & Active Sync New-ExchangeCertificate -GenerateRequest:$true -SubjectName "C=AU, O=Company, CN=mail.externalname.com" -DomainName mail.externalname.com, autodiscover.externalname.com, exc2007.internalname.local, autodiscover.internalname.local -FriendlyName "Microsoft Exchange 2007" -Path c:\Mail_mailcert.req -privatekeyexportable:$true If you are purchasing a certificate, this certificate request file “c:\*****.csr” now needs to be sent to the correct Certificate authority so they can generate a certificate with it. You will need to request a Unified Communication Certificate. Once the certificate is back from the authority, skip to step 6.Output Thumbprint Services…

Exchange 2007 SP1 Outlook Anywhere NTLM authentication for domain based and workgroup based computers

At the University in Sydney they have Exchange Server 2007 installed on Windows Server 2003 servers. They needed a solution for people to use Outlook Anywhere using laptops that were attached to the domain with logged on domain user accounts, also local user accounts with laptops that weren’t on the domain. However, they didn’t want to have the password dialog box popping up all the time primarily for the domain based users, and for users using local accounts, it was ok for the password dialog box to pop up when logging into Outlook. At first, when I tried to switch…

Using diskpart.exe with Hyper-V to setup storage

Find the appropriate disk.After logging in for the first time choose option 13 in HVConfig.cmd. This will open the command prompt if one isn’t already opened in the background already. Type the following command to list the disks in your system:diskpart.exeDISKPART> list disk   Convert the disk.When you only have one disk in your system you would choose to convert disk 0 to a dynamic disk:DISKPART> select disk 0DISKPART> convert dynamic   Reboot.Reboot your server to convert the disk.   Create the volume for the Virtual machines.You can now create the volume that spans the unused space on your disk….