Search found 49 matches

by daviesg6
Thu Nov 20, 2014 12:06 pm
Forum: PowerShell
Topic: Why does this not display the results in the output window
Replies: 32
Views: 15441

Re: Why does this not display the results in the output wind

if out-string does nothing, why did you tell me in one of my first posts last year, to use this to get the output displayed in the text box? Why does it work on EVERY other script and GUI? If I am doing something wrong how about telling me how to fix it rather than just telling me something that wor...
by daviesg6
Thu Nov 20, 2014 6:32 am
Forum: PowerShell
Topic: Why does this not display the results in the output window
Replies: 32
Views: 15441

Re: Why does this not display the results in the output wind

Look at the example I gave that works. In primal forms out-string $vsriable.focus() is the code used to point the output to the form element used for output. I have 2 other buttons on the form that execute different scripts, both of these say out-string $Results.Focus() and both of them display the ...
by daviesg6
Wed Nov 19, 2014 11:38 am
Forum: PowerShell
Topic: Why does this not display the results in the output window
Replies: 32
Views: 15441

Re: Why does this not display the results in the output wind

It isn't being written to a file, the last part of the code,
PowerShell Code
Double-click the code block to select all.
Out-String    $results.Focus()


tells it to display in the text box called results. As my question stated, if I changed this to write to a file it worked, but when it is set to display in the text window it gives nothing.
by daviesg6
Wed Nov 19, 2014 10:16 am
Forum: PowerShell
Topic: Why does this not display the results in the output window
Replies: 32
Views: 15441

Re: Why does this not display the results in the output wind

The code block you have edited was working, it was the first one, $LastLogonButton_OnClick= { $results.Text=$logons=@() [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().DomainControllers | ForEach{ $logonInt=(Get-Aduser -Filter "sAMAccountName -eq '$($EntryBox.text)'" ...
by daviesg6
Wed Nov 19, 2014 6:50 am
Forum: PowerShell
Topic: Why does this not display the results in the output window
Replies: 32
Views: 15441

Why does this not display the results in the output window

$LastLogonButton_OnClick= { $results.Text=$logons=@() [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().DomainControllers | ForEach{ $logonInt=(Get-Aduser -Filter "sAMAccountName -eq '$($EntryBox.text)'" -server $_.Name -properties lastlogon).lastlogon $logons+=[dateti...
by daviesg6
Wed Nov 19, 2014 6:43 am
Forum: PowerShell
Topic: loop query through all DCs
Replies: 7
Views: 4066

Re: loop query through all DCs

thanks, got it working as a standalone scriptnow
by daviesg6
Tue Nov 18, 2014 7:03 am
Forum: PowerShell
Topic: loop query through all DCs
Replies: 7
Views: 4066

Re: loop query through all DCs

I copied the code block into ISE and tried to run it. I know the $userid value is not valid so expected an error, but it gave me this: Get-ADUser : A parameter cannot be found that matches parameter name 'computer'. At line:5 char:39 + $logonInt=(Get-Aduser $userid -computer $_.Name -properties last...
by daviesg6
Mon Nov 17, 2014 1:35 pm
Forum: PowerShell
Topic: loop query through all DCs
Replies: 7
Views: 4066

Re: loop query through all DCs

I get I have to loop it through, I tried a few things and either got errors running the script or got lastlogon date as 1/1/1600, what I'm looking for is a pointer to how I do this within the script I have already, where do I create the list of DCs and how do I loop the lastlogontimestamp query thro...
by daviesg6
Mon Nov 17, 2014 1:04 pm
Forum: PowerShell
Topic: loop query through all DCs
Replies: 7
Views: 4066

loop query through all DCs

So I have a script that provides account info, all very nice and helpful for support staff. However, I need to provide accurate information relating to the last time a user logged on. I am using lastlogontimestamp and converting it to a readable format, but it does not provide the correct informatio...
by daviesg6
Mon Nov 17, 2014 8:53 am
Forum: PowerShell
Topic: convert output to human readable format
Replies: 2
Views: 1613

Re: convert output to human readable format

thanks, I knew it would be a simple fix