Why does the instr function in kixtart seems to not work correctly?

Mar 25
2014

Today, I had a problem with a login script specially for Windows 8 users with a microsoft account.

For these, the @userid macro of kixtart returns the full microsoft account, i.e. gregakselrod@outlook.com.

Since I was interested in the part before the @, I wrote the following script part:

$len = instr( @userid, “@” )
if $len == 0
$localuser = @userid
else
$localuser = substr( @userid, 1, $len – 1 )
endif

but it does not worked – $len was 0 all the time.

It seems kixtart interprets the @ character even if quoted. This is the fixed script:

$len = instr( @userid, chr( 64 ) )
if $len == 0
$localuser = @userid
else
$localuser = substr( @userid, 1, $len – 1 )
endif

Port reservation on Windows Server 2008 and 2008 R2 included SBS 2011

Jan 28
2014

If you need to reserve a port in Windows Server 2008, 2008 R2 or SBS 2001 (which is in fact a 2008 R2), it does not make any sense to modify the registry value

ReservedPorts

at

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

as indicated at in the Microsoft KB 812873, because Windows Server 2008 and 2008 R2 does not support this setting anymore.
You need to request a hotfix from this page KB 2665809, install it and then you can control your port ranges with the commands (from an administrative command prompt of course):

netsh int ipv4 show excludedportrange protocol=tcp

to display active reservations, and add with

netsh int ipv4 add excludedportrange protocol=tcp startport=8000 numberofports=1

.
The command is documented at the MS KB page where you can find the hotfix.

Open firewall from your application

Jan 28
2014

Since I had added SSL support to the SMTP sending from my application using stunnel, some users don’t opened up the firewall when requested from the operating system (from Windows Vista up).

Therefore I needed to open up the firewall directly from the application.

Since I don’t like to have run the application with elevated rights, I decided to make this change from an external app to spawn from my own application.

It is very simply to add a firewall rule using the netsh command:

netsh advfirewall firewall add rule name=”stunnel” dir=in action=allow program=”c:\tools\stunnel.exe” enable=yes profile=any

(where the stunnel.exe path should be adapted to your own settings).

The problem now was that this command needed to be run with elevated rights, and there is no option to do so.
After a quick search on the internet, I found elevate.exe – a small .NET executable that does what I need: launch a program with elevated rights.

So it was easy: launch elevate.exe (downloadable with sources) and pass as command line the call to netsh.exe.

WSUS and Windows 8/Windows 8.1 .NET Framework 3.5 installation from Windows Update

Nov 04
2013

This weekend, I have installed an SBS 2011 server that comes with WSUS for all domain PCs.

Unfortunately, after adding two Windows 8.1 PCs to the domain, they needed the .NET Framework 3.5 – not installed on Windows 8.x, but available as optional feature in the control panel (Programs and Features). This “feature” is installed through Windows Update, and not from the installation media.

With WSUS, this is not possible, and also the installation of printer drivers through Windows failed (HP does not delivers drivers for its OfficeJet K5400 printer, available only through Windows Update), and gave error 0x800F0906.

After a bit of searching, I found this article:

support.microsoft.com/kb/2734782

referring to exactly my problem.

Using the group policy editor (gpedit.msc) to modify the Administrative Templates, System, “Specify settings for optional component installation and component repair” to “Enabled” and checking the box “Contact Windows Update directly to download repair content instead of Windows Server Update Services (WSUS)”, followed by a gpupdate /force in an administrative command prompt, solved the problem.

So I would recommend to anyone in such an environment to change this setting in every Windows 8.x machine that is integrated in the domain.

Special Folders on Windows – or how to copy a program icon to desktop on Windows 8

Aug 17
2013

Have you ever had a problem of copying a program’s shortcut from the Program Menu to the desktop?

With Windows versions between NT and 7 absolutely no problem: open the start menu, select the item with a right mouse click and then select “Copy” from the context menu and “Paste” on the desktop.

With Windows 8 this is becoming very hard, unfortunately.

The Start Menu structure is here, but on the Start screen there is no possibility to copy the shortcut.

It is here:

c:\ProgramData\Microsoft\Windows\Start Menu

Unfortunately, this folder is also hidden.

And since I don’t like to fiddle every time, I have created the small utility OpenSpecialFolders that gives you a list of most special folders on the system and let you open them in a new explorer window, so copying and pasting shortcuts is a lot easier.

You can download a zip file with the exe and a few runtime DLLs here:

OpenSpecialFolders.zip

I hope this will help someone!

Add Windows 7 PC to Samba Domain after IP address change

Aug 16
2013

Today, I had to change all IP addresses on a customers Samba network. (Really, the customer had two separate networks, and I have unified them to one).

After this, I had to add several Windows 7 PCs to the Samba domain, but the process failed, and the logs on the Samba server had no entries on this.

The error message was:

“The specified domain either does not exist or could not be contacted”

I had added the registry entries specified here:

wiki.samba.org/index.php/Registry_changes_for_NT4-style_domains

but nothing.

Finally, the nblookup tool downloadable from Microsofts website pointed me in the right direction: incorrect wins data!

The solution was simple:

/etc/init.d/samba stop
rm /var/lib/samba/wins.*
/etc/init.d/samba start

This recreated the correct wins database wins.tdb and the PC could be joined to the database.

Limit user on Windows 8 tablet

Jan 21
2013

A customer has acquired a few Windows 8 tablet to use in a fair, and only to show pictures on them.

So the user on the tablet has to be very, very limited.

With the multiuser capability this is easy to accomplish. Simply create a new user and limit him:

– uninstalled all not needed apps from the apps screen, included the desktop app
– remove all files from the users start menu: delete all files and directories from
C:\Users\\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
– remove all rights for this user on the folder
C:\ProgramData\Microsoft\Windows\Start Menu\Programs
even the right to read it.
– logoff and logon the user

That’s it!

Reading from IniFile – StringBuilder 64 byte limit

Dec 06
2012

Today I have lost nearly 4 hours because I had strange crashs in my Vulcan application.

The error returned me to the VO times with the 5333 error – the GPF.

I had this code:

method GetString( cSection as string, cEntry as string, cDefault as string ) as string
local cReturn as string
local oReturn as System.Text.StringBuilder

oReturn := System.Text.StringBuilder{}

GetPrivateProfileString( cSection, cEntry, cDefault, oReturn, INI_STRING_LEN, _cFullPath )
cReturn := oReturn:ToString()

return cReturn

and sometimes it caused very strange crashes.

I had to correct the code as follows:

method GetString( cSection as string, cEntry as string, cDefault as string ) as string
local cReturn as string
local oReturn as System.Text.StringBuilder

oReturn := System.Text.StringBuilder{ INI_STRING_LEN }

GetPrivateProfileString( cSection, cEntry, cDefault, oReturn, INI_STRING_LEN, _cFullPath )
cReturn := oReturn:ToString()

return cReturn

because otherwise the StringBuilder class was initialized only with 64 byte and the API call corrupted the runtime memory.

IMHO such an error should be detected by the stringbuilder class itself.

No touch with Windows 8 on Acer Iconia Tab W500

Nov 24
2012

I have been running my Iconia Tab first with the Consumers Preview and then with the 90 day demo of the RTM version of Windows 8, and have been very satisfied with it. I used it mostly to test my first application written in Vulcan.NET specifically for touch use.

After the release of Windows 8 on the market, I installed an OEM version of Windows 8 64 bit on this tablet – and was very surprised, that the touch screen was not working. And a tablet without touch is completely useless. I searched on the internet, tried drivers, buth nothing. I have installed then a 32 bit version of Windows 8 with my OEM key – nothing.

Then I found a very interesting forum post in the german Acer forum: Windows 8 OEM will work only on Windows 8 certified hardware (and the Iconia Tab W500 is not), but Windows 8 Upgrade will be!!!!

Thanks to user MonitoMatze who posted this notice here (in german):

http://www.acer-userforum.de/acer-iconia-tab-w500-forum/48246-iconia-tab-w500-kein-touchscreen-nach-installationvon-win-8-pro-3.html#post382244

Tried to install from my Windows 8 Pro OEM media, using an upgrade key, not the OEM key (please note: installed from OEM media!) and the touchscreen worked!

Generally, I like Windows 8 on my tab because it is relatively fast and usable (and was at a reasonable price).

Deleted Google Calendar Events

Oct 30
2012

Several customers, and I myself, are using Google calendar to syncronize calendars between different mobile devices – like a poor man’s Exchange.

Now, a customer deleted all calendar events to cleanup an old Nokia device, and was very surprised that his calendar was empty also on his new iPhone.

After a search on the web, I have found this tool:

http://spanning.com/spannings-latest-free-tool-undelete-for-google-calendar/

With this I was able to recover his deleted items.