Monday, November 25, 2013

Page file manipulation using PowerShell

Handy little script for changing the location of the system page file using PowerShell.

 

######

######

######

 

$computer = Get-WmiObject Win32_computersystem -EnableAllPrivileges

$computer.AutomaticManagedPagefile = $false

$computer.Put()

$CurrentPageFile = Get-WmiObject -Query "select * from Win32_PageFileSetting where name='c:\\pagefile.sys'"

$CurrentPageFile.delete()

Set-WMIInstance -Class Win32_PageFileSetting -Arguments @{name="d:\pagefile.sys";InitialSize = 0; MaximumSize = 0}

 

######

######

######

 

I can’t take any credit for this script, I’m posting it here so that I can find easily find it again in the future J

Friday, November 08, 2013

Problems with FSRM (Quick Fix)

I recently installed FSRM on to a Windows 2012 server.

I started seeing a few strange issues when trying to use the FSRM powershell cmdlets. 

For example, when I run Get-FSRMQuota, a list of all currently applied quotas was meant to be returned.
Instead, I got no output at all from the command. Other powershell commands threw strange errors.

Whenever I tried to view the FSRM options screen, the MMC would crash and I'd get this error.


After a bit of digging it turns out that this a bug with the installation of FSRM which only occurs following the first reboot of a server hosting the FSRM role.

After you perform a second reboot or run:

net stop srmsvc
net start srmsvc

The problem goes away. 

I'm not sure what causes the issue, but I thought it would be useful to document this incase anyone else runs into the same issue.

AWS CLI writing into Dynamo DB

Just a quick snippet of AWS CLI for putting items into a dynamo DB.

############

aws dynamodb put-item --table-name users --item

'{
"userid": {"S": "1234356"},
"first" : {"S": "Mitchy"},
"lastname" : {"S": "Blog"},
"age" : {"N": "999"}
}'

############

N = Number value

S = String Value

Use conditional Puts to update or replace existing items.

The new line layout above is just to make it easier to read.

Tuesday, November 05, 2013

Troubleshooting Sysprep Domain Join Issues

I’ve spent the morning trying to figure out why a SYSPREP’d instance was not joining the domain.

 

Turns out that in the folder C:\Windows\Panther\UnattendGC there is an extremely useful log files called setupact.log.

 

This log provides a verbose breakdown what happens during the sysprep process for the machine in question.

 

 

To access the log you will need to launch notepad under Administrator context.

 

Once you open the log, search for the DJOIN string. From there you’ll see all sorts of juicy details about the domain joining sequence.

 

Once you find the error codes, google them and you’ll be up and running in no time.

 

A couple of example codes and their translation…

 

Error 1326: Logon failure: unknown user name or bad password.

Typically this error signifies a bad username or password.

 

Error 1355: The specified domain either does not exist or could not be contacted.

Typically this error signifies network, DNS, or WINS issues.

 

Error 2202: You specified an invalid user name or group name.

Typically this error signifies an invalid (incorrect format) username is being used. 

This can happen if you use a third party utility that creates the unattended.xml file used by sysprep.

 

A little about Me

My photo
My name is Mitch Beaumont and I've been a technology professional since 1999. I began my career working as a desk-side support engineer for a medical devices company in a small town in the middle of England (Ashby De La Zouch). I then joined IBM Global Services where I began specialising in customer projects which were based on and around Citrix technologies. Following a couple of very enjoyable years with IBM I relocated to London to work as a system operations engineer for a large law firm where I responsible for the day to day operations and development of the firms global Citrix infrastructure. In 2006 I was offered a position in Sydney, Australia. Since then I've had the privilege of working for and with a number of companies in various technology roles including as a Solutions Architect and Technical team leader.