Setting file permissions on a remote machine with PowerShell

Recently I needed to set some file permissions on a remote machine. Previously I’d done this relatively easily through a share as the user account I was using also had administrator rights on the other side and I was dealing with domain accounts. However, this did not work for a user that was local to […]

IIS Administration file access

If you are using the IIS Administration ReST API to manage IIS, one thing that is not immediately obvious is that if you put your websites outside of %systemdrive%\inetpub you won’t be able to access them through the API. e.g. You won’t be able to set the physical path of a website to a location […]

Taking ownership of a file

I’m currently looking at using IIS Administration as a way to automate some deployment tasks. However, the way it got installed, it’s appsettings.json file could not be written to, even when running the text editor as Administrator. It turns out, SYSTEM had full control of the file, and the installer configured it to only allow […]

Code Review: Making a drop down list out of an enum

I’ve come across code like this a couple of times and it is rather odd: IEnumerable<CalendarViewEnum> _calendarViewEnums = Enum.GetValues(typeof(CalendarViewEnum)).Cast<CalendarViewEnum>(); List selectList = new List<SelectListItem>(); foreach (CalendarViewEnum calendarViewEnum in _calendarViewEnums) { switch (calendarViewEnum) { case CalendarViewEnum.FittingRoom: selectList.Add(new SelectListItem { Text = AdminPreferencesRes.Label_CalendarViewFittingRoom, Value = ((int)calendarViewEnum).ToString(CultureInfo.InvariantCulture), Selected = (calendarViewEnum == CalendarViewEnum.FittingRoom) }); break; case CalendarViewEnum.Staff: selectList.Add(new SelectListItem […]

Code Review: FirstOrDefault()

I regularly review the code that I maintain. Recently, I’ve come across code like this fairly often: someCollection.FirstOrDefault().Id I cannot rightly comprehend why anyone would do this. FirstOrDefault() returns the first item in a sequence or the default value if it doesn’t exist (i.e. the sequence is empty). For a reference type (classes, basically) the default […]

What a waste of money by Currys (but win for GAME)

As the end of last year, I was at a Microsoft event where we got to see a number of new Microsoft technologies. At this event I got my first chance to have a look at the XBOX 360 Kinect. Since I’m not a gamer I hadn’t paid much attention to what a Kinect was […]