Rename the Administrator account using the command line

To rename the Administrator account (or any existing account) in Windows 7 using the command line, execute the following command:

wmic useraccount where name='Administrator' call rename name='newname'

Create scheduled task from command line

To create a scheduled task on other servers, use the command schtasks.exe:

Usage:
SchTasks
/create
/sc schedule
/d days to run
/tn task name
/ST Starting time
/tr task command
/ru user to run the task
/rp password for user
/rl permission level
/s computername

Bringing it all together.
To schedule a powershell command to backup the server via Windows Backup

SchTasks /create /sc weekly /d mon,tue,wed,thu,fri /tn "Full backup" /ST 15:00 /tr "powershell -command C:\scripts\server_backup.ps1" /ru domain\administrator /rp /rl HIGHEST /s SERVER01

When providing the /rp option without a password it will prompt you for it.

Add calendar permissions

As an Exchange administrator I sometimes get the request to change calendar permissions for ie. a new secretary to let him/her manage someones calendar.

With Powershell and Exchange 2010 there is no more need to log in as the manager or other way, you can use 1 command to get the same results:

Add-MailboxFolderPermission -Identity username:\calendar -User username -AccessRights reviewer

Where -Identity is the item on which you want to set permissions (it can also be contact or inbox). Be aware that it is language-aware, so in dutch it is: username:\agenda.
The following roles are available:

Owner
CreateItems, ReadItems, CreateSubfolders, FolderOwner, FolderContact, FolderVisible, EditOwnedItems, EditAllItems, DeleteOwnedItems, DeleteAllItems

PublishingEditor
CreateItems, ReadItems, CreateSubfolders, FolderVisible, EditOwnedItems, EditAllItems, DeleteOwnedItems, DeleteAllItems

Editor
CreateItems, ReadItems, FolderVisible, EditOwnedItems, EditAllItems, DeleteOwnedItems, DeleteAllItems

PublishingAuthor
CreateItems, ReadItems, CreateSubfolders, FolderVisible, EditOwnedItems, DeleteOwnedItems

Author
CreateItems, ReadItems, FolderVisible, EditOwnedItems, DeleteOwnedItems

NonEditingAuthor
CreateItems, ReadItems, FolderVisible

Reviewer
ReadItems, FolderVisible

Contributor
CreateItems, FolderVisible

You can also check what the current permissions on a particular folder are:

Get-MailboxFolderPermission -identity username:\agenda  | select User, FolderName, AccessRights

Get mailbox sizes per server

How to quickly identify those large mailboxes on your mailserver.
Open an Exchange Powershell window and past the following code:

Get-MailboxStatistics -server server.full.fqdn | where {$_.ObjectClass –eq “Mailbox”} | Sort-Object TotalItemSize –Descending | ft @{label=”User”;expression={$_.DisplayName}},@{label=”Total Size (MB)”;expression={$_.TotalItemSize.Value.ToMB()}},@{label=”Items”;expression={$_.ItemCount}},@{label=”Storage Limit”;expression={$_.StorageLimitStatus}} -auto

The output wil display 4 columns: User, Total Size (MB), Items and Storage Limit
It will be sorted by ‘total size’, the largest mailbox on top.

Be sure to change ‘server.full.fqdn’ to match your own server, probably servername will do.

This will work with Exchange 2007 and 2010

Harmon.ie defaults for installation

I wanted to provide for a ‘default’ setting for the free Sharepoint plugin from harmon.ie 2.1 i.e. with installations.

You first need a working computer with Outlook installed.

1. Download the installer from the location above, but do not continue installing. Grab the .msi from %userprofile%\Local Settings\Temp and copy it to a different location. Continue with the install and configure the plugin as needed from within Outlook.

2. Copy %userprofile%\Local Settings\Application Data\Mainsoft\Harmony\.metadata\.plugins\org.eclipse.core.runtime\
.settings\com.mainsoft.sharepoint.sidebar.prefs to where you saved the .msi.

3. Export the registry key [HKEY_CURRENT_USER\Software\Mainsoft] and save it as defset.reg, also where you saved the .msi. I removed the UserGuid just to be sure from the file.

4. Create a batch file with the following content (use the ‘copy’ link in the code below for the complete code, becouse of the length, linebreaks are off):

@echo off
msiexec /i HarmonieSharePointSetup.x86.msi /qb
mkdir "%userprofile%\Local Settings\Application Data\Mainsoft\Harmony\.metadata\.plugins\org.eclipse.core.runtime\.settings"
copy com.mainsoft.sharepoint.sidebar.prefs "%userprofile%\Local Settings\Application Data\Mainsoft\Harmony\.metadata\.plugins\org.eclipse.core.runtime\.settings"
regedit /s defset.reg

5. Run the batch file on another computer.

Note: you are not allowed to distribute the free version. Above is used for convenience only.

Drilling holes in the firewall for SQL server

First, Configure a Server to Listen on a Specific TCP Port (SQL Server Configuration Manager)

If enabled, the default instance of the SQL Server Database Engine listens on TCP port 1433. Named instances of the Database Engine and SQL Server Compact 3.5 SP1 are configured for dynamic ports. This means they select an available port when the SQL Server service is started. When you are connecting to a named instance through a firewall, configure the Database Engine to listen on a specific port, so that the appropriate port can be opened in the firewall.

For more information about the default Windows firewall settings, and a description of the TCP ports that affect the Database Engine, Analysis Services, Reporting Services, and Integration Services, see Configuring the Windows Firewall to Allow SQL Server Access.
To assign a TCP/IP port number to the SQL Server Database Engine

  1. In SQL Server Configuration Manager, in the console pane, expand SQL Server Network Configuration, expand Protocols for , and then double-click TCP/IP.
  2. In the TCP/IP Properties dialog box, on the IP Addresses tab, several IP addresses appear in the format IP1, IP2, up to IPAll. One of these is for the IP address of the loopback adapter, 127.0.0.1. Additional IP addresses appear for each IP Address on the computer. Right-click each address, and then click Properties to identify the IP address that you want to configure.
  3. If the TCP Dynamic Ports dialog box contains 0, indicating the Database Engine is listening on dynamic ports, delete the 0.
  4. In the IPn Properties area box, in the TCP Port box, type the port number you want this IP address to listen on, and then click OK.
  5. In the console pane, click SQL Server Services.
  6. In the details pane, right-click SQL Server () and then click Restart, to stop and restart SQL Server.

source: Microsoft Technet

Next, save the following code as a .cmd or .bat file and run it with administrative privileges:

[bat]
@echo ========= SQL Server Ports ===================
@echo Enabling SQLServer default instance port 1433
netsh firewall set portopening TCP 1433 "SQLServer"
@echo Enabling Dedicated Admin Connection port 1434
netsh firewall set portopening TCP 1434 "SQL Admin Connection"
@echo Enabling conventional SQL Server Service Broker port 4022
netsh firewall set portopening TCP 4022 "SQL Service Broker"
@echo Enabling Transact-SQL Debugger/RPC port 135
netsh firewall set portopening TCP 135 "SQL Debugger/RPC"
@echo ========= Analysis Services Ports ==============
@echo Enabling SSAS Default Instance port 2383
netsh firewall set portopening TCP 2383 "Analysis Services"
@echo Enabling SQL Server Browser Service port 2382
netsh firewall set portopening TCP 2382 "SQL Browser"
@echo ========= Misc Applications ==============
@echo Enabling HTTP port 80
netsh firewall set portopening TCP 80 "HTTP"
@echo Enabling SSL port 443
netsh firewall set portopening TCP 443 "SSL"
@echo Enabling port for SQL Server Browser Service’s ‘Browse’ Button
netsh firewall set portopening UDP 1434 "SQL Browser"
@echo Allowing multicast broadcast response on UDP (Browser Service Enumerations OK)
netsh firewall set multicastbroadcastresponse ENABLE
[/bat]
Source: Microsoft Support

Remote Web Workplace stops working with IE8

Locate and remove the following registry key:


HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Ext\Settings\{7584c670-2274-4efb-b00b-d6aaba6d3850}

Restart al IE instances