Giving write permissions through Remote Registry

By , April 28, 2011 11:50 am

So, today I had to give a user permission to access the Remote Registry on Windows Server 2008 R2 machine. You could be forgiven for thinking this would be a relatively trivial task.

Some quick googling revealed that before a user can even read anything, they must have permissions on the following key:

HKLM\SYSTEM\CurrentControlSet\Control\SecurePipeServers\winreg

Granting the user Read permission (or Full Control) on this key, enables them to connect to the remote registry and browse it. This is where the useful information stops, but it turns out in order to give the user permission to write to the registry you need to manually set their permission on every key they want to write to.

To be fair this is quite logical, it’d just be nice if it was documented somewhere :)

How-to Disable and Re-enable AD Replication on Windows Server 2008

By , March 30, 2011 10:29 am

At work today I had to disable replication to one of our 3 DCs. Unfortunately the internet wasn’t very forthcoming with such information, so after much scrabbling around and some google-fu I arrived at the following.

 

To disable replication you can run:

repadmin /options <your_dc> +DISABLE_INBOUD_REPL
repadmin /options <your_dc> +DISABLE_OUTBOUND_REPL

 

And to re-enable it again:

repadmin /options <your_dc> -DISABLE_INBOUND_REPL
repadmin /options <your_dc> -DISABLE_OUTBOUND_REPL

 

Finally, if you want to check the status of replication you can run

repadmin /showrepl

 

on the DC you want to know about.

Setup OSQA on CentOS 5.5

By , November 30, 2010 1:37 pm

This guide continues on from my previous guide on installing CentOS 5.5 on Hyper-V. Despite being based on CentOS, it should work on Red Hat Enterprise Linux, and principles will apply to many other Linux distributions as well.

Most of this is taken from the official OSQA documentation and modified slightly to fix a few problems I encountered along the way.

Continue reading 'Setup OSQA on CentOS 5.5'»

How-to install CentOS/Red Hat Enterprise Linux on a Hyper-V VM

By , November 24, 2010 7:21 pm

This guide will take you through the process of creating a Linux virtual machine on a Hyper-V host. It is assumed that you have Hyper-V setup already, and you know how to create VMs.

This guide will use a CentOS 5.5 netinstall, however the principle is the same for Red Hat Enterprise Linux 5.5, and any other form of install.

Continue reading 'How-to install CentOS/Red Hat Enterprise Linux on a Hyper-V VM'»

Look what I found…

By , October 15, 2010 11:00 pm

I’ve been doing a bit of tidying up and all that, and remembered I made this timelapse video of a Sunset over York Racecourse.

Just thought I’d share it again =)

Joining Windows 7 to a Samba Domain

By , October 4, 2009 12:08 pm

This is a problem I ran into at YSTV recently. We run a Samba 3 domain and have recently upgraded our Edit PCs to use Windows 7. Unfortunately Windows 7 out of the box will not join a Samba domain, saying that the “Domain does not exist or could not be contacted” after asking you for login credentials (so it must have contacted the domain controller already, right?!).

Fortunately though, the fix is quite simple. There are two things you need to do:

  1. Install at least samba 3.2.14. This was the oldest version I got to work under Gentoo, but at the time of writing it’s still masked in portage.
  2. Modify a few registry keys on your Windows 7 machines:
      HKLM\System\CCS\Services\LanmanWorkstation\Parameters
      DWORD  DomainCompatibilityMode = 1
      DWORD  DNSNameResolutionRequired = 0

      HKLM\System\CCS\Services\Netlogon\Parameters
      DWORD  RequireSignOnSeal = 1
      DWORD  RequireStrongKey = 1

      Some places will tell you to set the second two values to 0, however I’ve found this not to be necessary – you can just leave them to their defaults of ‘1’. If you run into problems, you can try switching to 0. Otherwise, it might be time to check server logs and make sure that NetBios is working correctly to resolve the Domain name to a Domain Controller.

It’s also worth pointing out, that after the “Welcome to the DOMAIN domain”  message, you may get a DNS error popup. You can safely ignore this, and all seems to work fine (and it doesn’t bother you again).

From Hate to Love in a little over a year…

By , October 4, 2009 12:38 am

It has been an interesting year, and those of you who know me should certainly agree. This last year has been my Industrial placement year as part of my Degree – All fun and games you might think. Mostly, you’d be right – aside from the daily struggle of commuting to Leeds every day.

It’s been a busy year in YSTV too. This time a year ago I had just rolled out a bunch of new servers, setup a new flash streaming solution and generally made life more difficult for myself (but better for everyone else, i hope!). A year later, and I’m at it again. This time I’ve rolled out some new high spec Edit PCs, complete with Windows 7. On top of that, myself and several others completely rewired and re-organised the Control Room.

 

However, what this post is all about is how my outlook on a certain few big corporations has changed – Microsoft and Apple.

Continue reading 'From Hate to Love in a little over a year…'»

Access is Denied Exception when writing to Spreadsheet from ASP.Net

By , September 16, 2009 5:48 pm

I recently got the following error message whilst trying to write to an excel file using the openXML library in ASP.Net and C#:

System.ApplicationException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at System.IO.IsolatedStorage.IsolatedStorageFile.nGetRootDir(IsolatedStorageScope scope)
at System.IO.IsolatedStorage.IsolatedStorageFile.InitGlobalsNonRoamingUser(IsolatedStorageScope scope)
at System.IO.IsolatedStorage.IsolatedStorageFile.GetRootDir(IsolatedStorageScope scope)
at System.IO.IsolatedStorage.IsolatedStorageFile.GetGlobalFileIOPerm(IsolatedStorageScope scope)
at System.IO.IsolatedStorage.IsolatedStorageFile.Init(IsolatedStorageScope scope)
at System.IO.IsolatedStorage.IsolatedStorageFile.GetStore(IsolatedStorageScope scope, Type domainEvidenceType, Type assemblyEvidenceType)
at MS.Internal.IO.Packaging.PackagingUtilities.ReliableIsolatedStorageFileFolder..ctor()
at MS.Internal.IO.Packaging.PackagingUtilities.GetDefaultIsolatedStorageFile()
at MS.Internal.IO.Packaging.PackagingUtilities.CreateUserScopedIsolatedStorageFileStreamWithRandomName(Int32 retryCount, String& fileName)
at MS.Internal.IO.Packaging.SparseMemoryStream.EnsureIsolatedStoreStream()
at MS.Internal.IO.Packaging.SparseMemoryStream.SwitchModeIfNecessary()
at MS.Internal.IO.Packaging.CompressEmulationStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at MS.Internal.IO.Packaging.CompressStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at MS.Internal.IO.Zip.ProgressiveCrcCalculatingStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at MS.Internal.IO.Zip.ZipIOModeEnforcingStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
at System.IO.StreamWriter.Write(String value)
at System.Xml.XmlTextEncoder.Write(String text)
at System.Xml.XmlTextWriter.WriteString(String text)
at System.Xml.XmlAttribute.WriteContentTo(XmlWriter w)
at System.Xml.XmlAttribute.WriteTo(XmlWriter w)
at System.Xml.XmlElement.WriteTo(XmlWriter w)
at System.Xml.XmlElement.WriteContentTo(XmlWriter w)
at System.Xml.XmlElement.WriteTo(XmlWriter w)
at System.Xml.XmlElement.WriteContentTo(XmlWriter w)
at System.Xml.XmlElement.WriteTo(XmlWriter w)
at System.Xml.XmlElement.WriteContentTo(XmlWriter w)
at System.Xml.XmlElement.WriteTo(XmlWriter w)
at System.Xml.XmlDocument.WriteContentTo(XmlWriter xw)
at System.Xml.XmlDocument.Save(Stream outStream)
at OfficeOpenXml.ExcelWorksheet.Save()
at OfficeOpenXml.ExcelWorkbook.Save()
at xxx.addDataSetToExcel(DataSet DataSetSource, String fileName, String title, String subject, String category, String comments, String fileType)

Turns out that this is in no way a common problem (google was not my friend on this occasion). After nearly an entire day trying to figure this one out I finally came accross the solution and intend to share it here:

The openXML library uses a MemoryStream object when creating the spreadsheet – When the amount of data your putting into your spreadsheet gets too large to be held in memory, it starts to offload the data to disk. This is where the problem arises.

For whatever reason, ASP.NET decides it’s going to try to put the data into an obscure directory that doesn’t always exist – C:\Documents and Settings\Default User\Local Settings\Application Data\IsolatedStorage. I’m not entirely sure why it comes up with Access is Denied, presumabley because the user in the application pool doesn’t have permission to create a directory?

In any case, if you get this problem, just create the above directory and make sure that the user in your application pool (or Everyone) has read and write access to it.

Spamtastic!

By , June 16, 2009 1:33 pm

This weekend saw a sudden surge of spam comments coming my way. Strangely though, the comments seem legit. No links to various websites, not random text – nothing. Just a few sentances that are so generic they seem relevant.

I let the first couple through – It wasn’t until I noticed i had comments from several different ‘people’ all from the same IP that I started to question it. Further investigation reveals a peculiar email address and that every ‘person’ has google as their website address.

Apparently this was a massive spam attack

So, for those with blogs beware. Comments along these lines should marked as spam:

KattyBlackyard
google.com
katty@ds4ns1ns2.cn
89.28.14.35
Submitted on 2009/06/15 at 11:09am

I really like your post. Does it copyright protected?

Scheduled PostgreSQL Database Backups

By , June 11, 2009 8:37 pm

I’ve just started using PostgreSQL as my database of choice for a few projects, and needed some way of scheduling backups. As a result I’ve created the following small bash script that will backup a given database and put it in a gzipped tar archive.

You can find the script in my svn repository here.

Usage is pretty simple:

backup_pgsql dbname

where dbname is the name of the database you want to backup.

By default, the script tries to put your backup in /tmp/ – you can change this behaviour by modifying the BACKUP_DIR variable in the script – make sure to include the trailing / though.

Now, of course this is only the backup part. To schedule this, you can edit your crontab file (usually found in /etc/crontab) and include a line like this:

1  3  * * *     root    backup_pgsql dbname

This will backup the database, dbname, at 03.01am every day. Assuming your backup_pgsql is in your PATH. I put mine in /usr/local/bin/ and chmod +x it. If you don’t want to do that, simply provide the full path to the script.

Panorama Theme by Themocracy