Search found 13132 matches

by jvierra
Mon Feb 18, 2019 9:53 pm
Forum: PowerShell GUIs
Topic: Datacopier for DaRT
Replies: 31
Views: 380

Re: Datacopier for DaRT

Here is a full demo of running a RoboCopy batch as an async job with a progress bar that updates in real time. The main form remains completely independent of the job and the job form can be completely controlled by the main form. All of the bits to drive RoboCopy from an array of job definitions al...
by jvierra
Mon Feb 18, 2019 7:01 pm
Forum: Windows PowerShell
Topic: Change date format in multiple CSV files
Replies: 6
Views: 149

Re: Change date format in multiple CSV files

It is a result of Excel settings and has nothing to do with PowerShell or scripting or a CSV.
by jvierra
Mon Feb 18, 2019 5:04 pm
Forum: PowerShell GUIs
Topic: Loop cycle through tabcontrol tabs
Replies: 2
Views: 40

Re: Loop cycle through tabcontrol tabs

Your code runs in an infinite loop. Here is the correct way to prevent infinite loops. Use a deterministic loop. $button1_Click={ for ($i = 0; $i -lt $tabControl1.TabCount;$i++) { $tabcontrol1.SelectedIndex = $i Write-Host $tabcontrol1.SelectedTab.Name UpdateNavButtons Start-Sleep -Seconds 5 } Write...
by jvierra
Mon Feb 18, 2019 4:50 pm
Forum: Windows PowerShell
Topic: Query OnPremise AD for Specific AD attributes not working?
Replies: 1
Views: 34

Re: Query OnPremise AD for Specific AD attributes not working?

You are using "=" and should be using "-eq".
by jvierra
Mon Feb 18, 2019 9:14 am
Forum: Windows PowerShell
Topic: Add one variable to another loop
Replies: 4
Views: 78

Re: Add one variable to another loop

You also have to select the browser.

Another way is:

$urls = Get-Content file
$webBrowser1.navigate($urls[0])
$webBrowser2.navigate($urls[1])
by jvierra
Mon Feb 18, 2019 8:34 am
Forum: Windows PowerShell
Topic: Add one variable to another loop
Replies: 4
Views: 78

Re: Add one variable to another loop

Just enumerate the contents of the file in a ForEach-Object.

help foreach -online

Read the examples to learn how to use it.

Or use foreach()

help about_foreach
by jvierra
Mon Feb 18, 2019 8:31 am
Forum: PowerShell GUIs
Topic: Datacopier for DaRT
Replies: 31
Views: 380

Re: Datacopier for DaRT

Here is a method that does not use jobs and will not break. It is a project zipped.

You can wrap the form in a runspace and it will free up the main form to continue to work while the runspace executes the code.
by jvierra
Fri Feb 15, 2019 7:27 pm
Forum: Windows PowerShell
Topic: Change date format in multiple CSV files
Replies: 6
Views: 149

Re: Change date format in multiple CSV files

Just import the CSV and loop through it chaging each field to whatever format you want.

$csv.Field = ([datetime]$csv.Field).ToString(<you format>)
by jvierra
Fri Feb 15, 2019 5:09 pm
Forum: Windows PowerShell
Topic: Change date format in multiple CSV files
Replies: 6
Views: 149

Re: Change date format in multiple CSV files

Also note that you can create custom temlates:

Code: Select all

PS D:\scripts> $template = 'M-d-yyyy'
PS D:\scripts> $timeinfo = '1-12-2012'
PS D:\scripts> [DateTime]::ParseExact($timeinfo, $template, $null)
Thursday, January 12, 2012 12:00:00 AM
by jvierra
Fri Feb 15, 2019 4:54 pm
Forum: Windows PowerShell
Topic: Change date format in multiple CSV files
Replies: 6
Views: 149

Re: Change date format in multiple CSV files

This is not an issue. PowerShell can convert hundreds of formats. PS D:\scripts> [datetime]'3-feb-1999' Wednesday, February 3, 1999 12:00:00 AM PS D:\scripts> [datetime]'2/13/1999 3:12' Saturday, February 13, 1999 3:12:00 AM PS D:\scripts> [datetime]'12/13/1999' Monday, December 13, 1999 12:00:00 AM...