Categories
Hints and Tips Windows

Powershell ISE Editor Tip

Here’s an interesting tip – if you need an editor on a Windows server that handles Unix line endings you can use Powershell ISE … it’s not installed by default, but open a Powershell prompt and enter these commands: 

Import-Module ServerManager
Add-WindowsFeature PowerShell-ISE

And you will have a half-decent editor.

Categories
Hints and Tips One-liners Windows

fsutil one-liner

fsutil fsinfo ntfsinfo X:

where X: is the drive letter gives output like this:

NTFS Volume Serial Number : 0x101051a010518e1a
NTFS Version : 3.1
LFS Version : 2.0
Number Sectors : 0x0000000074498860
Total Clusters : 0x000000000e89310c
Free Clusters : 0x000000000447f222
Total Reserved : 0x00000000000016e2
Bytes Per Sector : 512
Bytes Per Physical Sector : 512
Bytes Per Cluster : 4096
Bytes Per FileRecord Segment : 1024
Clusters Per FileRecord Segment : 0
Mft Valid Data Length : 0x0000000025ec0000
Mft Start Lcn : 0x00000000000c0000
Mft2 Start Lcn : 0x0000000000000002
Mft Zone Start : 0x0000000003cfca20
Mft Zone End : 0x0000000003d00040
Max Device Trim Extent Count : 512
Max Device Trim Byte Count : 0xffffffff
Max Volume Trim Extent Count : 62
Max Volume Trim Byte Count : 0x40000000
Resource Manager Identifier : 5646BA81-xxxx-yyyy-zzzz-185E0F1F2F38

Categories
Hints and Tips Windows

Delete Too Long File Paths on Windows

The 260 character limit on the file path makes deleting the file from applications like Weblogic problematic (especially the .patch_storage sub-folder structure). As a result the PeopleTools DPK “cleanup” command doesn’t actually clean everything up.

Use:

ROBOCOPY D:\TEMP\EMPTY .patch_storage /PURGE

or /MIR to delete the files recursively, where D:\TEMP\EMPTY is an empty folder.

Categories
Hints and Tips One-liners Perl SQL Server Windows

Opening UTF-16LE files in Perl

Placeholder for useful code snippet:

open my $fh, '<:raw:perlio:encoding(UTF-16LE):crlf', $filename

which will convert CR/LF combinations to LF only. Alternatively, to keep them intact:

open my $fh, '<:raw:perlio:encoding(UTF-16LE)', $filename

Useful for reading Windows registry export files, SQL server log export files etc.

Categories
Hints and Tips PeopleTools PUM VirtualBox Windows

EnableLinkedConnections and VirtualBox PUM Images

When you map a network drive to the Samba share of a VirtualBox PUM VM in order to install (say) the PeopleTools client, the mapped drive may be invisible to your cmd prompt running as Administrator – something you need in order to update the registry and install the client software.

To work around this on Windows 7 through 10, see this article:

https://technet.microsoft.com/en-us/library/ee844140(v=ws.10).aspx

Categories
Tuning Windows

TrustedInstaller.exe – Memory and CPU Hog!

What an obscene memory and CPU hog this can be. I’ve seen it grow to 3.2 Gb of RAM on one of my servers.

As it is used for Windows Updates, I stop the related Windows Services and mark them as manual to avoid this issue.

The services to stop/set to manual are:

“Windows Installer Modules Installer”
“Windows Update”

Sure, I have to manually update but I want that on my servers.

Categories
Windows

Setting Windows Compatibility Mode in Batch Files

Quick tip. Need to run an executable in a different compatibility mode? Set this environment variable appropriately prior to running the executable:

SET __COMPAT_LAYER=WIN95

Valid values for __COMPAT_LAYER:

WIN95 - Windows 95
WIN98 - Windows 98
WIN4SP5 - Windows NT 4.0 SP5
WIN2000 - Windows 2000
WINXPSP2 - Windows XP SP2
WINXPSP3 - Windows XP SP3
VISTARTM - Vista
VISTASP1 - Vista SP1
VISTASP2 - Vista SP2
WIN7RTM - Windows 7 
WINSRV03SP1 - Windows Server 2003 SP1
WINSRV08SP1 - Windows Server 2008 SP1

 

Categories
Administration Windows

Using SC to stop remote services

I generally use PSExec from the Sysinternals Suite, but here is another approach if you are not allowed to install external tools or it is blocked by (say) a virus checker:

Use sc.exe to achieve the same end result e.g.

1
2
3
4
5
6
7
8
9
10
11
12
13
REM
REM Establish IPC connection so we are authenticated with the remote machine
REM
net use \\remote\IPC$ /user:local-username-on-remote-machine remote-user-password 
REM 
REM Use system console (sc.exe) command line tool to STOP or START services on remote machine
REM Note: The service name needs to match the one shown in services on the remote machine
REM
sc \\remote stop service-name 
REM
REM Delete the IPC credentials
REM
net use \\remote\IPC$ /delete

This is particularly useful in larger PeopleSoft installs where you have installed the Web servers/App servers/Process Schedulers as NT services. You did do that didn’t you? 🙂

Note: This came from a posting somewhere else on the web – I am not claiming it is my idea!

Categories
MSI VirtualBox Windows

Error 1719 Installing VirtualBox 64-bit on Windows 7

If you are encountering this error installing the x64 version of VirtualBox on Windows 7, then there is a good chance it is because the MSI installer service is trying to execute a custom action in 32-bit mode. The error message about the Windows Installer is somewhat misleading in this case.

To verify this is the case, run the VirtualBox executable from a command prompt with the /logging parameter and review the logfile created. If this is the cause of the problem, you will see an error like this in the log:

MSI (s) (DC:98) [12:00:00:000]: Custom Action Server rejected – Wrong Context
MSI (s) (DC:B8) [12:00:00:001]: CA Server Process has terminated.

The fix is a very simple Windows Registry change using to set the WOW64 entry to 0 (zero) for the msiserver i.e.

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\msiserver]
WOW64=0

Note: For the change to take effect, the Windows Installer Service must be restarted under Services.

There is a more detailed explanation by Aaron Stebner over on MSDN: http://blogs.msdn.com/b/astebner/archive/2011/05/16/10165211.aspx

 

Categories
Abomination Windows

Windows “start” command and quoting

Well you learn something new every day! I just discovered that if the first parameter to the windows “start” command is quoted, then it assumes that is the title of the Window.

This can be particularly annoying if the path to the executable you are trying to start contains spaces e.g. “C:\Program Files (x86)\Microsoft Office\Office14\winword.exe” so you are forced to quote it.

The solution is to add an empty string (or a genuine window title) before the executable:

start “” “C:\Program Files (x86)\Microsoft Office\Office14\winword.exe”

Don’t get me started on how **crappy** and inconsistent this behaviour is 🙂

Spaces in directory/file names are an abomination!