Search found 11848 matches

by jvierra
Thu Feb 22, 2018 9:08 am
Forum: Windows PowerShell
Topic: Datagridview - Go to row with letter on keydown
Replies: 2
Views: 65

Re: Datagridview - Go to row with letter on keydown

Gather the searchable items into an autocomplete textbox and let the user select from the dynamically filtered list. You can also use a DataTable source and use the row filter to force display of all matching values on each keystroke. The grid will display only all matching rows to the filter expres...
by jvierra
Thu Feb 22, 2018 9:03 am
Forum: Windows PowerShell
Topic: Receive-Job output is empty sometimes
Replies: 2
Views: 85

Re: Receive-Job output is empty sometimes

Nice job. Here is a more reliable way of coding this: Function Start-DriveEncryption { Param ( [Parameter(Mandatory = $true)] [Hashtable]$args ) $StatusBar.Text = "Enabling encryption" Write-Log -message "Enabling encryption" -component $script:component Add-JobTracker -Name 'DriveEncryption' -JobSc...
by jvierra
Tue Feb 20, 2018 2:30 pm
Forum: PowerShell GUIs
Topic: Resizable form: textboxes?
Replies: 1
Views: 75

Re: Resizable form: textboxes?

You will need to anchor to one or two location. Expanding a grid in four directions will be unmanageable. In some cases you have to catch the sizing event and manually calculate the limits.
by jvierra
Tue Feb 20, 2018 9:43 am
Forum: PowerShell GUIs
Topic: Problem with form refresh
Replies: 3
Views: 105

Re: Problem with form refresh

You cannot access a form from a job and you shouldn't try. Doing so can deadlock the form.
You cannot wait on a job in an event as it will freeze the form. Use the JobTracker control and your issues will be gone.
by jvierra
Tue Feb 20, 2018 4:24 am
Forum: PowerShell GUIs
Topic: Calculate inside textbox
Replies: 2
Views: 40

Re: Calculate inside textbox

It is possible to evaluate a string.

$s = '5 * 2 + 3'
Invoke-Expression $s
by jvierra
Mon Feb 19, 2018 3:16 am
Forum: PowerShell GUIs
Topic: New project: Globals.ps1 (imported) not loading?
Replies: 2
Views: 119

Re: New project: Globals.ps1 (imported) not loading?

You need to create the new project and copy the contents of globals and startup into the new files replacing the contents. Look in the project control files to see how a project is defined and loaded. Project file example: (*.psproj) <Project> <Version>2.0</Version> <FileID>83930c21-654d-4223-acdc-3...
by jvierra
Mon Feb 19, 2018 12:51 am
Forum: Windows PowerShell
Topic: need to speedup this script
Replies: 6
Views: 209

Re: need to speedup this script

Try this: $allgroups = $Groups | ForEach-Object{ $groupname = $_.Name Get-QADGroupMember $_.DN -Indirect -SizeLimit 0 | select @{n='GroupName';e={$groupname}},* } If this takes too long then you need to fix your system. The old Quest CmdLets are not compatible with the newer PowerShell and Windows. ...
by jvierra
Sun Feb 18, 2018 12:10 pm
Forum: PowerShell GUIs
Topic: ISE vs Jobform
Replies: 10
Views: 212

Re: ISE vs Jobform

Each job calls completed when it is finished. To detect if the current user is an admin on the current machine use this: [bool]([System.Security.Principal.WindowsIdentity]::GetCurrent().Groups |?{$_ -eq 'S-1-5-32-544'}) To find any user in Administrators: [bool](Get-LocalGroupMember administrators |...
by jvierra
Sun Feb 18, 2018 11:36 am
Forum: PowerShell GUIs
Topic: ISE vs Jobform
Replies: 10
Views: 212

Re: ISE vs Jobform

You need to remember that a job cannot reference any controls or variables in the form. All things must be passed as arguments to the job.

The hang was caused by the long timeout with ADSI when trying to access a non-responsive or non-existent computer.
by jvierra
Sun Feb 18, 2018 9:33 am
Forum: PowerShell GUIs
Topic: ISE vs Jobform
Replies: 10
Views: 212

Re: ISE vs Jobform

Many subtle difference. The Invoke works the way I posted it. The job must be launched correctly so I made that more explicit. Look more closely: $jobscript = { Param ($PC) #-------------------------------------------------- #TODO: Set a script block #Important: Do not access form controls from this...