Search found 59 matches

by obrienc
Tue Aug 01, 2017 12:18 pm
Forum: Windows PowerShell
Topic: Calling .exe
Replies: 15
Views: 4106

Re: Calling .exe

It's in the system32 folder. And this is in my
Env: %SystemRoot%\system32
by obrienc
Tue Aug 01, 2017 12:11 pm
Forum: Windows PowerShell
Topic: Calling .exe
Replies: 15
Views: 4106

Re: Calling .exe

$form1_Load = { #TODO: Initialize Form Controls here } $buttonFindFreeJumpBox_Click = { $Servers = "jump01", "jump02", "jump03" foreach ($s in $Servers) { qwinsta /server:$s | Select-Object -Skip 1 | ForEach-Object{ [pscustomobject]@{ Session = $_.SubString(1, 10) UserName = $_.SubString(19, 20) ID...
by obrienc
Tue Aug 01, 2017 11:45 am
Forum: Windows PowerShell
Topic: Calling .exe
Replies: 15
Views: 4106

Re: Calling .exe

It's there. It returns the desired result in the console.

I wrapped this

Code: Select all

$queryResults = (".\qwinsta.exe /server:$ServerName" | foreach { (($_.trim() -replace "\s+", ",")) } | ConvertFrom-Csv)
in quotes and it doesn't give an error but no output.
by obrienc
Tue Aug 01, 2017 11:31 am
Forum: Windows PowerShell
Topic: Calling .exe
Replies: 15
Views: 4106

Re: Calling .exe

$queryResults = (qwinsta /server:$ServerName | foreach { (($_.trim() -replace "\s+", ",")) } | ConvertFrom-Csv) ERROR: qwinsta : The term 'qwinsta' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a ERROR: path was included...
by obrienc
Tue Aug 01, 2017 10:58 am
Forum: Windows PowerShell
Topic: Calling .exe
Replies: 15
Views: 4106

Calling .exe

Is it possible to call this from a form? Its located in c:\windows\system32

Code: Select all

qwinsta /server:$ServerName
by obrienc
Fri Jul 21, 2017 7:22 am
Forum: Windows PowerShell
Topic: Scheduled task parameter
Replies: 15
Views: 3111

Re: Scheduled task parameter

got it to work by adding .Trim(). Now get-scvirtualmachine takes the passed var. ## parse xml from forwarded eventlog ## $event = Get-WinEvent @{ LogName = 'ForwardedEvents'; ID = 6101 } -MaxEvents 1 [xml]$xmlEvent = $event.ToXml() $ph = $xmlEvent.Event.EventData.Data[0] -split 'to ' $vm = $ph[0].Tr...
by obrienc
Fri Jul 21, 2017 6:43 am
Forum: Windows PowerShell
Topic: Scheduled task parameter
Replies: 15
Views: 3111

Re: Scheduled task parameter

The XML I posted was from the collector. The doubletake job event 6101 includes the vm name and node in the same element which is why I have to parse it to get he vm name. The node also has its own element so I can do this and it works. $string = Get-WinEvent -ComputerName $node -LogName $logname|wh...
by obrienc
Thu Jul 20, 2017 1:33 pm
Forum: Windows PowerShell
Topic: Scheduled task parameter
Replies: 15
Views: 3111

Re: Scheduled task parameter

That xml was from the collector in the ForwardedEvents log. I only forward ID 6101. Not sure if that's what you meant.

($xmlevent.Event.EventData.Data[1]) returns fqdn of the vm.

Code: Select all

get-scvirtualmachine -name $vm 
fails even though the vm is in the variable.
by obrienc
Thu Jul 20, 2017 12:27 pm
Forum: Windows PowerShell
Topic: Scheduled task parameter
Replies: 15
Views: 3111

Re: Scheduled task parameter

The exact reason you stated is why I started down the xml path. On the collector I couldn't see the message to parse and that is where I want to trigger the script from, a scheduled task
by obrienc
Thu Jul 20, 2017 12:23 pm
Forum: Windows PowerShell
Topic: Scheduled task parameter
Replies: 15
Views: 3111

Re: Scheduled task parameter

Event Xml: <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"> <System> <Provider Name="Double-Take Management Service" /> <EventID Qualifiers="16384">6101</EventID> <Level>4</Level> <Task>0</Task> <Keywords>0x80000000000000</Keywords> <TimeCreated SystemTime="2017-07-19T16:05:49....