It appears to work for me.
.hg/hgrc
[hooks]
commit = powershell.exe -File "C:\users\andy\desktop\test\test.ps1"
test.ps1
$repodir = "C:\Users\andy\Desktop\Test"
cd $repodir
$hguser = (hg tip) | ? {$_ -match '^user:\s+([\w\s]+\w)'} | % {$matches[1]}
$hguser | Out-File user.txt -Encoding ASCII
user.txt is populated via TortoiseHg/hg.exe commit. Using TortoiseHg 2.7.