I've recently been trying to get automatic Windows updates working on Vista. Every time it tried to fetch the updates, it reported an error code of 80070057. After getting more detailed information from the WindowsUpdate.log in the Windows directory, the problem turned out to be the proxy server in our office. Whilst my user profile has the correct proxy server settings, the Background Intelligent Transfer Service (BITS) that is used to download Windows updates doesn't. The solution is to set the proxy server for the system.
To see the current proxy settings, run from the command line:
If it says "direct", there are no proxy settings and Windows update probably will not work.
To set the proxy settings, run from the command line (you will probably need to run this with administrative permissions):
netsh winhttp set proxy proxy-server="yourproxy:port"
This will set the proxy server on the system to allow the BITS service to connect to the Windows updates servers.
June 25th, 2008
If you have ever run some SQL within SQL Server Management Studio only to realise that you've run it against the master database by mistake, you'll know that it can sometimes be hard to undo the damage.
A simple way to stop these accidental changes is to create a database trigger that will prevent any schema changes to the master database:
CREATE TRIGGER StopSchemaChanges ON DATABASE FOR
CREATE_APPLICATION_ROLE, ALTER_APPLICATION_ROLE, DROP_APPLICATION_ROLE,
CREATE_ASSEMBLY, ALTER_ASSEMBLY, DROP_ASSEMBLY,
CREATE_CERTIFICATE, ALTER_CERTIFICATE, DROP_CERTIFICATE,
GRANT_DATABASE, DENY_DATABASE, REVOKE_DATABASE,
CREATE_FUNCTION, ALTER_FUNCTION, DROP_FUNCTION,
CREATE_INDEX, ALTER_INDEX, DROP_INDEX,
CREATE_PROCEDURE, ALTER_PROCEDURE, DROP_PROCEDURE,
CREATE_SCHEMA, ALTER_SCHEMA, DROP_SCHEMA,
CREATE_STATISTICS, DROP_STATISTICS, UPDATE_STATISTICS,
CREATE_TABLE, ALTER_TABLE, DROP_TABLE,
CREATE_TRIGGER, ALTER_TRIGGER, DROP_TRIGGER,
CREATE_VIEW, ALTER_VIEW, DROP_VIEW
RAISERROR(N'Do you really modify the master database?', 16, 1) WITH NOWAIT
Any time you attempt to change the master database, SQL Server will fail with an error. If you do want to make a schema change, simply disable the trigger and then re-enable it once the schema change is complete.
(NB. this only works with SQL Server 2005)
June 8th, 2008