We appreciate the contributions many of you have been able to make towards repairing the storm damage and keeping a roof over our heads. With your help we’ve been able to complete much of the critical work. There is still work to be done to secure the house and your continued support will be a huge help.
Guests have read-only access to our forums. If you wish to participate you will need to register. Be sure to activate your account from the email sent to you when you register.
I'm running v3.22.0 (although this was tested in v3.21.0 also) and one of my PS1 custom scripts is not working correctly. If I copy the script out to an actual PS1 file and run it from Powershell it works correctly, but I'm getting no result (n/a) when trying to call it within the DesktopInfo app.
CMD=interval:60,color:55cc77,text:WiFi Status,onload,no-wait:2,read-as-csv:1, \
csv-header:1,file:powershell.exe, parameters:-Command "& { %wifi-status% }", \
trim:1,show-window:0,hide-no-result:0, alarms:(%BSSID% ne %BSSID% #ff0000), \
display:SSID: %SSID% Encryption: %Auth% / %Cipher%| BaseStation ID: %BSSID% Type: %NetType%| Radio: %Radio% {{{ Band: %Band% }}} Channel: %Channel% Signal: %Signal%
[wifi-status.ps1]
# Pull data from 'netsh' command and parse
$wifi_status = @( netsh wlan show interfaces )
$wifi_status = $wifi_status -replace '[\[\]=]',''
$wifi_status = $wifi_status.Replace(' : ',' = ')
$wifi_status = $wifi_status.Split('=').Trim()
If ( -not $wifi_status[ [Array]::indexOf($wifi_status,'State') + 1 ].Contains('connected') ) { Exit 0 }
For ( $i = 0; $i -lt $wifi_status.Count; $i++ ) {
If ( [string]::IsNullOrEmpty($wifi_status[$i]) ) { $wifi_status[$i] = 'n/a' }
}
$State = $wifi_status[ [Array]::indexOf($wifi_status,'State') + 1 ]
$SSID = $wifi_status[ [Array]::indexOf($wifi_status,'SSID') + 1 ]
# Check for naming update from 'BSSID' to 'AP BSSID'
If ( [Array]::indexOf($wifi_status,'BSSID') -eq '-1' ) {
$BSSID = $wifi_status[ [Array]::indexOf($wifi_status,'AP BSSID') + 1 ]
} Else {
$BSSID = $wifi_status[ [Array]::indexOf($wifi_status,'BSSID') + 1 ]
}
# Check for AKM-24 cipher for Wifi 7 devices
$Cipher = $wifi_status[ [Array]::indexOf($wifi_status,'Cipher') + 1 ]
If ( $wifi_status[ [Array]::indexOf($wifi_status,'Connected Akm-cipher') + 2 ].Contains('00-0f-ac:24') ) {
$Cipher = $Cipher + ' (AKM-24)'
}
$NetType = $wifi_status[ [Array]::indexOf($wifi_status,'Network type') + 1 ]
$Radio = $wifi_status[ [Array]::indexOf($wifi_status,'Radio type') + 1 ]
$Auth = $wifi_status[ [Array]::indexOf($wifi_status,'Authentication') + 1 ]
$Band = $wifi_status[ [Array]::indexOf($wifi_status,'Band') + 1 ]
$Channel = $wifi_status[ [Array]::indexOf($wifi_status,'Channel') + 1 ]
$Signal = $wifi_status[ [Array]::indexOf($wifi_status,'Signal') + 1 ]
# Output headers and data
Write-Host State ',' SSID ',' BSSID ',' NetType ',' Radio ',' Auth ',' Cipher ',' Band ',' Channel ',' Signal
Write-Host "$State" ',' "$SSID" ',' "$BSSID" ',' "$NetType" ',' "$Radio" ',' "$Auth" ',' "$Cipher" ',' "$Band" ',' "$Channel" ',' "$Signal"
Exit 0
it works for me without any adjustments other than adding the SET-SECTION. Better than my version LOL!
I do have the SET-SECTION in mine, I just forgot to add it to the code block in my original message. I'm wondering if MS changed something that's preventing DesktopInfo from properly processing it on my system. I know if I run the code directly it gives me the expected output.
The super confusing part is that I have multiple other custom scripts being run, for BitLocker and Drive Status; WAN IP Address and Reverse DNS and CPU Microcode Revision, all of which are working just fine.
try putting %1 %2 %3 %4 on the CMD display output so you can see the exit/error codes at each stage. See page 80 -ish.I do have the SET-SECTION in mine, I just forgot to add it to the code block in my original message. I'm wondering if MS changed something that's preventing DesktopInfo from properly processing it on my system. I know if I run the code directly it gives me the expected output.
@glenn So I tried %1 %2 %3 etc. and what I got was the entire string that is supposed to be split into the array as a result in %1 and %10. (I'm guessing %10 may just be showing %1 and adding a 0 after the text, but I'm not sure.
Ok, so I made another adjustment and used the below section, and got "n/a", but when I commented out the header row and told it NOT to use a header row on the CSV output, it worked.
## Output headers and data Write-Host State ',' SSID ',' BSSID ',' NetType ',' Radio ',' Auth ',' Cipher ',' Band ',' Channel ',' Signal Write-Host "$State" ',' "$SSID" ',' "$BSSID" ',' "$NetType" ',' "$Radio" ',' "$Auth" ',' "$Cipher" ',' "$Band" ',' "$Channel" ',' "$Signal"
see page 79@glenn So I tried %1 %2 %3 etc. and what I got was the entire string that is supposed to be split into the array as a result in %1 and %10. (I'm guessing %10 may just be showing %1 and adding a 0 after the text, but I'm not sure.
I've reviewed the manual multiple times. If I tell it "CSV-HEADER:1" and include the header line "Write-Host State ',' SSID ',' BSSID ',' NetType ',' Radio ',' Auth ',' Cipher ',' Band ',' Channel ',' Signal" in my script, I get "n/a". If I set it to "CSV-HEADER:0" and comment out the header line in the script, I get data. See attached screenshot.
i forgot you need to switch off read-as-csv when displaying the error codes. so something like this will give you the 3 error codes as follows:I've reviewed the manual multiple times. If I tell it "CSV-HEADER:1" and include the header line "Write-Host State ',' SSID ',' BSSID ',' NetType ',' Radio ',' Auth ',' Cipher ',' Band ',' Channel ',' Signal" in my script, I get "n/a". If I set it to "CSV-HEADER:0" and comment out the header line in the script, I get data. See attached screenshot.
%1 Create Process result (1=success, 0=fail)
%2 if %1 is 0 this is the Create Process error code (why Create Process failed to create a process, if %1=1, %2=0 )
%3 command exit code, ie powershell (if we successfully created and executed the powershell process, this is the actual powershell exit code)
SET-SECTION=key:wifi-status,value:wifi-status.ps1
CMD=interval:60,color:55cc77,text:WiFi Status,onload,no-wait:2,read-as-csv:0, wide:1,\
csv-header:1,file:powershell.exe, parameters:-Command "& { %wifi-status% }", \
trim:1,show-window:0,hide-no-result:0, alarms:(%BSSID% ne %BSSID% #ff0000), \
display: %1 %2 %3
powershell returns 110 for me even tho it's working...
Ok, swapped up the settings and attached a screenshot of the output.
237. I haven't found a list of powershell error codes so i don't know what 237 means or even what 110 means.
At this point I'd be taking that procedure back to a single line of code and seeing if that works. For example:
[wifi-status.ps1] # Pull data from 'netsh' command and parse $wifi_status = @( netsh wlan show interfaces ) Write-Host SSID Write-Host "Hello world"
And then progressively adding lines of code until it stops working. I've struck occasional oddness in the way it behaves which I can't explain. All I can do is try to find a subtly different way of achieving the same result.
So I decided to expand the DesktopInfo window to see the full output on each line in the debug and found something interesting. I highlighted it in the attached screenshot.
hrm, i wonder what that is? so have a look at the text encoding of your desktopinfo.ini file.So I decided to expand the DesktopInfo window to see the full output on each line in the debug and found something interesting. I highlighted it in the attached screenshot.
[options] # size and position monitor-mode=1 monitor-num=1 top=0 right=0 width=930 display-offsetx=5 display-offsetxr=5 column1width=100 auto-scale=1 # interface transparency=10 allowdrag=0 # font font-face=Arial font-size=9 font-charset=1 font-rtl=0 font-quality=6 # application logging log=desktopinfo_log.txt log-level=debugonerror eventlog-level=error # notify=1 # other ignore-setting-change=1 auto-home=300 share-data=1 # strings [text] # error messages noresults=<n/a> null-result=<n/a> error=[error] unknown=Unknown executing=Loading, please wait... # menu dialog menu-reload=Reload menu-configuration=Edit Configuration menu-log=Open Log File menu-manual=Read Manual menu-about=About Desktop Info menu-quit=Quit # navigation nav-previous=Previous nav-home=Home nav-next=Next [items] NAV=global:-1,font-face:webdings,caption-prev:7,caption-home:<,caption-next:8,align:c PAGE=1 PAGE-TITLE=Home Page
