Network Cable Unplugged – Windows 8 / Netgear DGN2000






When I ran up my Windows 8 box, it was connected to an enterprise LAN, and everything was tracking along just fine. When I brought the box home and connected it to my Netgear DGN2000 home router via Ethernet, I started experiencing disconnection every couple of minutes or so, with ‘network cable unplugged’ as my network status. The network connection would drop and reconnect automatically, returning after a short outage on its own. Very strange.

None of my existing computers had any problems connecting through this network and I initially misdiagnosed this as a problem with my Hyper-V virtual switch settings, thinking perhaps the servers sharing the same network connection was causing the problem.

Well. As I will often do, it turned out I was massively over thinking the problem. When Windows 8 started using the Ethernet adapter Intel(R) 82579V Gigabit Network Connection, it set itself to “Auto Negotiate” on the adapter’s network speed settings and the Netgear router didn’t take kindly to this, disconnecting the machine every few seconds. It would seem my router has developed a fault with the Ethernet ports, possibly related to overheating (I have always had the device propped up on two cassette tapes to aid airflow, however it still runs pretty hot). It doesn’t mind the PC connecting at 100mbps full duplex however, so I’ve resorted to that for the time being.

To get to the below options, access Device Manager > Network Adapters > Ethernet adapter properties > Advanced Tab. Setting it back to 100 Mpbs full-duplex fixed the issue.

Ethernet Adapter Properties

Posted in Hyper-V, Windows 8 | Tagged , , | 2 Comments

Word VBA Macro > Create DOC to PDF & Email

A while back, I had a request to automate the way users can create a PDF file from MS Word, and attach it to an email – essentially create a Word to PDF macro, with automatic email creation.  Currently their entire process would be:

  • Save to PDF (File > Save As > .PDF / File > Print > Adobe PDF)
  • Choose target folder & save
  • Rename newly created PDF (as it creates with the source Word document’s name)
  • Attach to Outlook & send
  • Delete the PDF from disk

Also, part of the problem was the way that Outlook locks up when the ‘Send to Email’ function is initiated from Word, so you need to save your new message as a draft in order to switch back to the main Outlook view & find a recipient’s email address, for example. I was looking for ways around this & came up with the below VBA code with the help of a colleague, saved inside each user’s normal.dotm file thereby applying to every document they create from our CRM.

The macro was added to their quick launch toolbar in Word 2010 (with a user-friendly envelope icon) via login scripts replacing their normal.dotm, allowing them a one-click option to initiate the code & be presented with the filename prompt. I used H:\ as the target location because every user has the home drive by default, and some users would be using this within Citrix without permission to the system C:\

The process is now as follows:

1: User completes their Word document & hits the shortcut to run the EmailPDF macro:

Word 2010 Macro Button

Word 2010 Macro Button

2: Macro executes & prompts for the filename to use:

Filename Prompt for Word PDF Macro

Filename Prompt for Word PDF Macro

3: Attachment is added with correct name to blank email:

Outlook Message With PDF Attachment

Outlook Message With PDF Attachment

Full code is below, this can obviously be cleaned up a little & offer friendlier error messages, but this wasn’t a priority for me – if the user cancels the process halfway through & gets a generic error message, then so be it.

You will also need to add a reference in Word to the Microsoft Outlook 14.0 Object Library to get this to work. If you find this useful, please leave me a comment because I would love to know. Any suggestions to improve the below would also be welcomed.

Should you wish to do the same function in Excel, please see this post.

Sub EmailPDF()
 Dim strData As String
 Dim ola As Outlook.Application
 Dim maiMessage As Outlook.MailItem
 Dim fs strData = InputBox("Please Enter Filename")
 strData = "h:\" & strData & ".pdf"

'Creates a PDF and stores it locally
 ActiveDocument.ExportAsFixedFormat OutputFileName:= _
 strData, ExportFormat:= _
 wdExportFormatPDF, OpenAfterExport:=False, OptimizeFor:= _
 wdExportOptimizeForPrint, Range:=wdExportAllDocument, From:=1, To:=1, _
 Item:=wdExportDocumentWithMarkup, IncludeDocProps:=False, KeepIRM:=True, _
 CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
 BitmapMissingFonts:=True, UseISO19005_1:=False
 On Error Resume Next

'Start Outlook if it isn't running
 Set oOutlookApp = GetObject(, "Outlook.Application")
 If Err <> 0 Then
 Set oOutlookApp = CreateObject("Outlook.Application")
 End If

'Create a new message
 Set oItem = oOutlookApp.CreateItem(olMailItem)
 oItem.Display

'Add attachment
 oItem.Attachments.Add strData

'Create a file system object to delete temporary file
 Set fs = CreateObject("Scripting.FileSystemObject")
 fs.deletefile strData
 End Sub





Posted in Macro, MS Word, VBA | Tagged , , , | 11 Comments

Lowering Active Directory Domain / Forest Functional Level

Well… my previous post about my sole domain controller corrupting caused me to go off and promote a new domain controller as a contingency.

When I set up my lab, I set the functional level to Server 2012 in order to see what the differences would be. My current domain controller is Server 2012, but my other hosts are all 2008 R2… because of this, I couldn’t promote my existing hosts to domain controllers & didn’t fancy running up a new 2012 box purely for this backup role. Running dcpromo on the host in it’s current state results in an error “The functional level of the domain or the forest is incompatible with this operating system”

So it left me with the question, how am I going to rollback the functional level to 2008 R2 to let me do this? Well, PowerShell obviously…

Firstly I had to lower the forest to the required level, via:
Set-ADForestMode -Identity domain.local -ForestMode Windows2008R2Forest
(substituting domain.local for the FQDN of my domain)

And then I could lower the domain functional level:
Set-ADDomainMode -Identity domain.local -DomainMode Windows2008R2Domain

Then running a dcpromo on my 2008 R2 host again allowed me to configure it as a new domain controller.

 

Posted in Active Directory, Server 2008, Server 2012 | Tagged , , , , | 1 Comment

Server 2012 Crashing – Error 0xc00002e2

Well… today I had a power outage at my house, and my Hyper-V lab was shut down abruptly. When I brought the computer up again my hosts had crashed, and my domain controller was stuck in a rebooting loop with this:

Server 2012 0xc00002e2 Crash ErrorYour PC ran into a problem and needs to restart. We’re just collecting some error info, and then we’ll restart for you. (0% complete). If you’d like to know more, you can search online later for this error: 0xc00002e2)

 

Ouch…. this isn’t good, as this is my only domain controller in the lab currently and I deleted my VM snapshots when troubleshooting a previous issue (d’oh).

As expected, the computer reboots and launches the new 2012 recovery console. It gives me usual options for safe mode & command prompt as well as system restore… I don’t have any system restores, and launching the command prompt and selecting sfc /scannow does little to help.

I started looking at the VM config in Hyper-V Manager, checking the RAM & CPU values, the IDE controller settings are normal (but I detached the ISO I had mounted to the DVD drive just to be safe). Everything else looks fine….

Then I noticed that the SCSI controller option has a hard disk listed, with no VHD mounted. I was playing around with this a week or so ago & hadn’t realised that I’d left this setting applied.

So I shut down the host, removed the SCSI config, hit the start button and crossed my fingers…. and now it’s back in action. A quick snapshot because hindsight is 20/20, and it’s goodnight from me. Tomorrow I’m building a second DC…

Posted in Hyper-V, Server 2012 | Tagged , , , , | 9 Comments