User Rights Assignment: Log on as a batch job

Scheduling tasks on windows you need at least “Log on as a batch job” rigths. Here you find the default settings:

https://technet.microsoft.com/en-us/library/dn221944.aspx?f=255&MSPPError=-2147217396

Advertisements

How to Write on the same line with Write-Output

Powershell cmdlet Write-Output on some case is preferable instead of Write-Host; I need to use Start-Transcript and (probably a bug) Write-Host do not make any entry on transcript file.

But Write-Output is missing some nice features like -nonewline.. I need to append a string on the same line of previous output:

try {
    start-transcript -path C:\transcript.txt -Append
    # My Job
    Write-Output "1 - Job one"
    [console]::setcursorposition($([console]::Cursorleft + 25),$([console]::CursorTop - 1))
    Move-Item C:\Test.txt C:\TestDone.txt -force -ea Stop
    Write-Output "    [OK]"
}
catch [Exception] {
    Write-Output "    [FAIL]"
    $ScriptError = $_.Exception.Message
    Write-Warning $ScriptError
}
finally {
    Stop-Transcript
}

The trick was done by:

[console]::setcursorposition

[console]::Cursorleft is your current column
[console]::CursorTop is you current line

Probably with the same trick you can overwrite the previews output…

Problem: Can’t print anymore on Fedora 26

Some days ago my Fedora 26 workstation stop printing on a HP 1505n connected via network. This is what i found on eventlog:

[  234.320486] pdftopdf[2220]: segfault at 10 ip 00007f34fd4ea19f sp 00007ffee7b72d80 error 6 in libc-2.25.so[7f34fd461000+1c7000]

pdftopdf is crashing… and here the bug: https://bugzilla.redhat.com/show_bug.cgi?id=1478537

Update to qpdf-libs-6.0.0-8.fc26 for solve the problem.

How to Disable SMB1

WannaCry and Co. suggest that it’s time to remove some old protocol, and SMB1 it’s one of that.

Here you find a script that is usefull for that; run it as admin rights:

Disable-SMB1.cmd

This batch call a powershell script (check that all the scripts is stored on the same folder and that the execution path is where you store the scripts)

I used a batch to bypass the powershell signature and make easier for helpdesk to runas as admin.

For disable it with GPO, check this:
https://support.microsoft.com/en-us/help/2696547/how-to-enable-and-disable-smbv1-smbv2-and-smbv3-in-windows-and-windows

PROBLEM: Outlook Indexing is not reliable

If you recently start to have problem with Outlook search after June patches rollout, this is a know issue:

https://support.office.com/en-us/article/Outlook-known-issues-in-the-June-2017-security-updates-3f6dbffd-8505-492d-b19f-b3b89369ed9b?ui=en-US&rs=en-US&ad=US

Based on your OS there is a fix release (check the link above) or, if you prefer a workaround; a reg key to add.

 

Some other links regarding indexing problem:

https://support.microsoft.com/en-us/help/2769651/outlook-search-returns-no-matches-found
https://support.microsoft.com/en-us/help/2925203/incomplete-search-results-may-occur-in-outlook-when-a-pdf-ifilter-is-i