Search found 14694 matches

by jvierra
Tue Feb 16, 2021 1:29 pm
Forum: PowerShell GUIs
Topic: Globals.ps1 in Form Project Variable question
Replies: 5
Views: 133

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: 242

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: 242

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: 242

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: 242

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: 155

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...
by jvierra
Wed Feb 10, 2021 6:03 pm
Forum: PowerShell
Topic: Passing Exchange Session to Start-Job
Replies: 3
Views: 155

Re: Passing Exchange Session to Start-Job

The answer is that you can't. A job runs in a s3eparte process and a session is process bound. You must connect separately in the job.
by jvierra
Thu Feb 04, 2021 3:09 am
Forum: PowerShell
Topic: Get Windows Scripting Host info with PowerShell
Replies: 1
Views: 283

Re: Get Windows Scripting Host info with PowerShell

To do this you would have to enable auditing of the WSH engine (cscript, wscript). The audit records would then be available in the event log.
by jvierra
Wed Feb 03, 2021 1:22 pm
Forum: PowerShell
Topic: powershell scripting.
Replies: 1
Views: 354

Re: powershell scripting.

Hi Daniel Your issues are4 all a result of lack of knowledge of the basics of PowerShell. This wilkl make everything including how to use PSS very difficult. I recommend starting with a simple book to get you started. The first four chapters of this free and excellent introductory book will get you ...
by jvierra
Tue Feb 02, 2021 10:24 am
Forum: PowerShell GUIs
Topic: Refresh Gridview, focus on row selected in middle of grid (scrollbar)
Replies: 1
Views: 141

Re: Refresh Gridview, focus on row selected in middle of grid (scrollbar)

https://docs.microsoft.com/en-us/dotnet ... ngRowIndex

$dataGridView1.FirstDisplayedScrollingRowIndex = $dataGridView1.SelectedRows[0].Index