Search found 14688 matches

by jvierra
Thu Feb 18, 2021 11:29 pm
Forum: PowerShell GUIs
Topic: $datagridview1.AutoSizeColumnsMode = 'Fill' - howto size after cell content?
Replies: 3
Views: 370

Re: $datagridview1.AutoSizeColumnsMode = 'Fill' - howto size after cell content?

The length of the columns changes dynamically to the width of the column of text when you set the mode to do so. YOU cannot set bot "Fill" and autosize at the same time.
by jvierra
Tue Feb 16, 2021 6:14 pm
Forum: PowerShell GUIs
Topic: Globals.ps1 in Form Project Variable question
Replies: 5
Views: 112

Re: Globals.ps1 in Form Project Variable question

Again. There is no reason for this except if you have done something to prevent the functions from being loaded. I recommend starting with a new project and adding one small piece of code at a time until you discover your mistake. You can also just run under the debugger and step through the code to...
by jvierra
Tue Feb 16, 2021 4:18 pm
Forum: PowerShell GUIs
Topic: Globals.ps1 in Form Project Variable question
Replies: 5
Views: 112

Re: Globals.ps1 in Form Project Variable question

Then you may have them defined twice or some other issue with your project.

Start a new project with one form and test the variables. Once you see that then you may discover where in the code you are failing.
by jvierra
Tue Feb 16, 2021 2:56 pm
Forum: PowerShell GUIs
Topic: $datagridview1.AutoSizeColumnsMode = 'Fill' - howto size after cell content?
Replies: 3
Views: 370

Re: $datagridview1.AutoSizeColumnsMode = 'Fill' - howto size after cell content?

You can set the width in the designer or you can do it in code.
by jvierra
Tue Feb 16, 2021 1:29 pm
Forum: PowerShell GUIs
Topic: Globals.ps1 in Form Project Variable question
Replies: 5
Views: 112

Re: Globals.ps1 in Form Project Variable question

You don't say where in "globals" yo7u are defining these variables. They must be defined outside of any function.

Another good method is:

$global:Application = "System Tools"
$global:ApplicationVersion = "1.0.0"

$textbox1.Text = $global:Application
by jvierra
Mon Feb 15, 2021 6:25 pm
Forum: PowerShell
Topic: Script Cannot Find Called Script
Replies: 7
Views: 208

Re: Script Cannot Find Called Script

The ultimate outcome of all misadventures with computers is that, as dumb as they are, they always show us that humans are maters of dumb.

Good luck and may the force be with you -- or at least, not annoy you too much.
by jvierra
Mon Feb 15, 2021 1:51 pm
Forum: PowerShell
Topic: Script Cannot Find Called Script
Replies: 7
Views: 208

Re: Script Cannot Find Called Script

OR

$result = & $pathToScript\CALLEDSCRIPT.ps1 -Variable1 $var1 -Variable2 $var2
by jvierra
Mon Feb 15, 2021 1:49 pm
Forum: PowerShell
Topic: Script Cannot Find Called Script
Replies: 7
Views: 208

Re: Script Cannot Find Called Script

You still do not want the ampersand.

Invoke-Expression "$pathToScript\CALLEDSCRIPT.ps1 -Variable1 $var1 -Variable2 $var2"
by jvierra
Fri Feb 12, 2021 3:56 pm
Forum: PowerShell
Topic: Script Cannot Find Called Script
Replies: 7
Views: 208

Re: Script Cannot Find Called Script

You don't need quotes to call a PS1 script. YOu don't need to use&. $result = \\SERVER\PATH TO SCRIPT\CALLEDSCRIPT.ps1 -Variable1 $var1 -Variable2 $var2 If there are spaces in teh path then do this: $result = \\SERVER\'PATH TO SCRIPT'\CALLEDSCRIPT.ps1 -Variable1 $var1 -Variable2 $var2 Note the singl...
by jvierra
Wed Feb 10, 2021 9:00 pm
Forum: PowerShell
Topic: Passing Exchange Session to Start-Job
Replies: 3
Views: 149

Re: Passing Exchange Session to Start-Job

You also have to detect errors and decide what to do with them. You cannot use Invoke Command with a job. A job just takes a script block that contains the code to be executed. help start-job -online - read all of the help until you have a clear idea of how jobs work. You can also search for numero...