Thursday 31 December 2015

Great electrician

Spoke with these guys yesterday on their day off
http://www.checkatrade.com/RKBuilders/
image
and they still gave me great advice which helped me with some light fitting that I had spent the morning struggling with.
Can thoroughly recommend their services. Father and son team, and I spoke to the son, who really knew his stuff when it came to GU10 halogen downlight bayonet fitting.

Wednesday 16 December 2015

Speech with windows powershell

Set-ExecutionPolicy Unrestricted -Force

<#
.Synopsis
   Allows you to speak on a remote computer
   Requires that you have run winrm qc on the remote machine
   or Enable-PSRemoting. And on the local machine you've changed
   Set-Item -Path WSMan:\localhost\Client\TrustedHosts -Value * -Force 
.DESCRIPTION
   Allows you to speak on a remote computer
.EXAMPLE
   Speak-Remote 1 "How are you today" REMOTE_PC
.EXAMPLE
   Speak-Remote -RemoteComputerName REMOTE_PC
#>
function Speak-Remote
{
    [CmdletBinding()]
    [OutputType([int])]
    Param
    (
        # Param1 help description
        [Parameter(Mandatory=$true,
                   ValueFromPipelineByPropertyName=$true,
                   Position=0)]
        [string]
        $Times = (Read-Host "How many Times"),

        # Param2 help description
        [Parameter(Mandatory=$true,
                   ValueFromPipelineByPropertyName=$true,
                   Position=1)]
        [string]
        $Message = (Read-Host "What should I say"),

        [Parameter(Mandatory=$true,
                   ValueFromPipelineByPropertyName=$true,
                   Position=2)]
        [string]
        $RemoteComputerName
    )

    Begin
    {
    }
    Process
    {
        Invoke-Command -ScriptBlock {Param($msg, $n) Add-Type -AssemblyName System.Speech; $o = New-Object -TypeName System.Speech.Synthesis.SpeechSynthesizer; $o.SelectVoice("Microsoft Zira Desktop") ; $y = 0; do { $o.Speak($msg);$y = $y + 1;} until ($y -eq $n) } -ComputerName $RemoteComputerName -ArgumentList $Message, $Times
    }
    End
    {
    }
}

Speak-Remote -RemoteComputerName REMOTE_PC

How to find the last interactive logons in Windows using PowerShell

Use the following powershell script to find the last users to login to a box since a given date, in this case the 21st April 2022 at 12pm un...