Search found 271 matches

by localpct
Fri Jun 08, 2018 12:17 pm
Forum: PowerShell GUIs
Topic: $radiobutton1.Checked =$true not working
Replies: 8
Views: 680

Re: $radiobutton1.Checked =$true not working

You have an if instead of an elseif on the "Power Saver" line: if ($PowerSetting -eq "Balanced") { $radiobuttonHighPerformace.Checked = $true } elseif ($PowerSetting -eq "Power Saver") { $radiobuttonHighPerformace.Checked = $true } else { $radiobuttonBalanced.Checked = $true } Looks like this did i...
by localpct
Fri Jun 08, 2018 12:14 pm
Forum: PowerShell GUIs
Topic: $radiobutton1.Checked =$true not working
Replies: 8
Views: 680

Re: $radiobutton1.Checked =$true not working

I suggest that stepping through with the debugger would give you the answer. This article will show you how to use WMI to easily get the power settings: https://blogs.technet.microsoft.com/heyscriptingguy/2010/08/31/get-windows-power-plan-settings-on-your-computer-by-using-powershell/ GWMI doesn't ...
by localpct
Fri Jun 08, 2018 11:23 am
Forum: PowerShell GUIs
Topic: $radiobutton1.Checked =$true not working
Replies: 8
Views: 680

$radiobutton1.Checked =$true not working

I'm trying to detect the powersettings for a PC $PowerSetting = Invoke-Command -ComputerName $computer { (powercfg /l | ? { $_.Contains('*') -and $_.Contains('GUID') }).Split()[3] } $statusbar1.Text = "Finding Power Setting" $PowerSetting = switch ($PowerSetting.trim()) { "381b4222-f694-41f0-9685-ff...
by localpct
Wed Mar 07, 2018 8:00 am
Forum: PowerShell GUIs
Topic: Textbox: best default behavior?
Replies: 2
Views: 432

Re: Textbox: best default behavior?

Why would you clear a textbox on the textchanged event? seems like you're asking for issues This is how I handle mine $assetname_TextChanged = { #TODO: Place custom script here if ($assetname.Text -match $env:COMPUTERNAME -and $assetname.Text.Length -eq 8) { $wshell = New-Object -ComObject Wscript.S...
by localpct
Wed Mar 07, 2018 6:10 am
Forum: PowerShell GUIs
Topic: Using LinkLabel to send email with details
Replies: 6
Views: 960

Re: Using LinkLabel to send email with details

Why open outlook?

Code: Select all

Send-MailMessage -Body "" -to "" -From "" -Subject "" -SmtpServer ""
by localpct
Wed Mar 07, 2018 6:05 am
Forum: PowerShell GUIs
Topic: Add textbox with explanation on item in form?
Replies: 1
Views: 262

Re: Add textbox with explanation on item in form?

Seems like a lot of information so maybe an additional form

I think that's too much info for a tooltip
by localpct
Fri Mar 02, 2018 9:37 pm
Forum: PowerShell GUIs
Topic: Display string from txt file in DGV
Replies: 3
Views: 503

Re: Display string from txt file in DGV

Ah! That’s what I was missing. I think.

What if I add the results to a pscustomobject?
by localpct
Fri Mar 02, 2018 8:50 pm
Forum: PowerShell GUIs
Topic: Display string from txt file in DGV
Replies: 3
Views: 503

Display string from txt file in DGV

Within the ISE this works $destinations = Get-content C:\Users\user\Desktop\PCs.txt foreach ($destination in $destinations) {$destination} I tried to turn this into a job and it's only displaying the length of the Destination ApplicationUpdater-v1.psf My company doesn't have SCCM so I'm working with...
by localpct
Thu Feb 15, 2018 11:25 pm
Forum: Windows PowerShell
Topic: Variables to CSV at end of Jobs
Replies: 2
Views: 877

Re: Variables to CSV at end of Jobs

Ah! Good eye. Alright so after an hour of digging through my code and realizing some failures. I'm 100% if has to do with this block. I have this code inside my $assetname_textchanged event if ($assetname.Text -match '\d{6}' -and $assetname.Text.Length -eq 6) { $assetname.Text = "PC" + $assetname.Te...
by localpct
Thu Feb 15, 2018 2:29 pm
Forum: Windows PowerShell
Topic: Variables to CSV at end of Jobs
Replies: 2
Views: 877

Variables to CSV at end of Jobs

I have this simple code that I've been using for a year or so now that collects the data passed through. The problem is once I put it in a Job, it either doesn't run due to ERROR: You cannot call a method on a null-valued expression. Test.psf (34, 3): ERROR: At Line: 34 char: 3 ERROR: + [PSCustomObj...