Showing posts with label Microsoft. Show all posts
Showing posts with label Microsoft. Show all posts

Wednesday, 26 August 2015

PDFtk Burst PDF in a Windows Command Prompt (Batch File)

I had a user at work who needed to expand PDF files into their individual pages. 
This is the solution I came up with, using PDFtk and a bit of cmd script.
It creates files in a sub folder called output, so make sure that exists before you try and run it.

<code>
@echo off
setlocal EnableDelayedExpansion
set "source=%~dp0"
set "name=%1"

IF DEFINED name (
 call :burst %name%
 ) else (
 call :usage
 )
goto :xit

:burst
 set "file=%~nx1"
 echo Working on %file%
 for /f "skip=1" %%x in ('wmic os get localdatetime') do if not defined mydate set mydate=%%x
 SET "mytime=%mydate:~0,14%"
 pdftk %name% burst output "%source%output\%file%_%mytime%_%%04d.pdf"
 for %%d in (%source%output\doc_data.txt) do del %%d
 echo Done!
 goto :EOF

:usage
echo Nothing to do... drag a file onto me!
goto :EOF

:xit
endlocal
timeout /T 3
<\code>

Friday, 27 February 2015

Acer BSOD 0x000000F4 after SSD Upgrade

BSOD 0x000000F4 picture

Today a colleague presented me with his Acer laptop and the BSOD pictured above. (0x000000F4)
It's a couple of years old (20011?) and was recently upgraded with a Crucial MX100 SSD and 8GB of Crucial RAM.

It had never exhibited this error prior to the memory or SSD upgrade, so I was less than amused by the situation, especially since the SSD was not accessible without powering off the machine, leaving me with no Dump File to check.

After much testing, it transpired that it would only crash when on battery power, and never in Safe Mode. This led me to look at the drivers which were loaded during a "normal" boot.
After a bit of trial and error, upgrading the Intel drivers etc, I uninstalled the Acer Power Management software. This has resolved the issue and the laptop will now transition between mains and battery power just fine.


Wednesday, 28 January 2015

remote desktop gateway server is temporarily unavailable

I've been playing with RD Web this week, and was getting the following error when attempting to Connect to a remote PC - "remote desktop gateway server is temporarily unavailable" on my Server 2012 R2 test rig.

I'm able to use Remote Desktop Connection if I manually specify my gateway server settings. 
After much Googling it occurred to me that it could be because I'm running my RDWeb server on an unusual external port. I've already had to configure the HTTP and UDP Transport settings to match my bespoke port (RD Gateway Manager properties), so I drilled down into the Application Settings in IIS Manager and added :PORT# to the end of my FQDN in the DefaultTSGateway field.

I've ended up with something along the lines of:    rdw.domain.com:1234

This subtle change (after a refresh of the REWeb portal in the browser) seems to have done the trick.

Thursday, 20 February 2014

Softether VPN client default route

Softether VPN Client

I've been using the built in Windows VPN client (L2TP) to connect to my VPN server, but had a problem with the MAC Address changing, thus was unable to assign a static one via DHCP.

To overcome this, I swapped to using the Softether Client, but discovered another issue.

I wasn't able to stop the VPN becoming my default route. It became THE gateway for all of my internet traffic... Something that I didn't want to happen. I'm using this to provide remote access to servers, not to hide my internet traffic, so I don't want it going half way across the world before getting out of the building.

There doesn't seem to be an obvious toggle to change this behaviour in the client software unlike the nice tick box that Microsoft provide, but I have discovered a work-around.

This is working for myself and a colleague, but YMMV. If there is a better way, please do let me know!

It involved a couple of steps:

  • In softEther VPN Client Manager edit the Properties of your VPN. On the Advanced Settings... button, tick the No Adjustments of Routing Table under Other Configurations.
  • Run ncpa.cpl (Network Connections from Control Panel)
  • Edit the Properties of your VPN Client Adapter. Change the IPv4 TCP/IP settings; under Advanced change the Interface metric to 100 (for example)
  • Edit the same value for the NIC you want to use for your internet and change it to a really low number. I used 1 for LAN and 2 for WiFi.
Test! You can check the routes and metric values from a command prompt using route print

This certainly worked for me and doesn't seem to have impacted my LAN sessions, even when the VPN is not connected.
It's not ideal, but if you find yourself in the same situation, it might just help!

Monday, 4 March 2013

Failed to schedule Software Protection service for re-start

I have been running Windows 8 for a while now, upgraded from 7.

I've been seeing the following error in my Event Viewer for a while and decided to look into it:


Failed to schedule Software Protection service for re-start at 2113-02-08T11:19:03Z. Error Code: 0x80070002.


After much searching I found this thread on Technet that covers deleting and reinstalling the offending scheduled task.

http://social.technet.microsoft.com/Forums/en/winservergen/thread/6f986797-0db9-454d-9979-dbc625f09b82

So, with thanks to Yan Li I was able to stop the error occurring, but I did encounter a different error when attempting to import the task from my backup:

(24,9): Priority

The error message isn't very helpful, but comparing the XML with that of SvcRestartTaskLogon, I noticed that the following section in SvcRestartTask

<RestartOnFailure>
      <Priority>3</Priority>
      <Priority>PT1M</Priority>
</RestartOnFailure>


in SvcRestartTaskLogon is


<RestartOnFailure>
      <Interval>PT1M</Interval>
      <Count>3</Count>
</RestartOnFailure>

I changed the offending lines in SvcRestartTask and it now imports correctly.