Support Forums

Search found 10622 matches

by jvierra
Fri Apr 21, 2017 10:04 pm
Forum: PowerShell GUIs
Topic: calling local .EXE not giving results
Replies: 3
Views: 130

Re: calling local .EXE not giving results

I explained before that you cannot use Invoke command.

Here is an example that works:
by jvierra
Fri Apr 21, 2017 12:46 pm
Forum: Windows PowerShell
Topic: Convert string to hex for registry
Replies: 16
Views: 172

Re: Convert string to hex for registry

Note that you can also just do this:

reg add HKCU\Test /v test1 /t REG_BINARY /d 003000310031 /f

Adding a property to the registry will also create the key if it does not exist.
by jvierra
Fri Apr 21, 2017 12:21 pm
Forum: Windows PowerShell
Topic: Convert string to hex for registry
Replies: 16
Views: 172

Re: Convert string to hex for registry

EDIT: When I run [System.Text.Encoding]::Unicode.GetBytes('0.1.1.')|%{[System.Convert]::ToString($_,16)} I get 30 0 2e 0 31 0 2e 0 31 0 2e 0 which is wrong for the printer The registry does not have any dots. It is just how regedit displays an array of bytes. To see the raw value use REG. reg query...
by jvierra
Fri Apr 21, 2017 12:13 pm
Forum: Windows PowerShell
Topic: Making data grid item a hyperlink
Replies: 3
Views: 97

Re: Making data grid item a hyperlink

In the designer add the column and select hyperlink as the column control type.
by jvierra
Fri Apr 21, 2017 12:12 pm
Forum: Windows PowerShell
Topic: Convert string to hex for registry
Replies: 16
Views: 172

Re: Convert string to hex for registry

Considering you want to store this in the registry then this is all you need to do.

$bytes = [System.Text.Encoding]::Unicode.GetBytes('12345')
New-ItemProperty -PAth HKCU:\SOFTWARE\TestKey1 -Name Test1 -Value $bytes -PropertyType BINARY

regbin.png
regbin.png (18.98 KiB) Viewed 41 times
by jvierra
Fri Apr 21, 2017 12:01 pm
Forum: Windows PowerShell
Topic: Convert string to hex for registry
Replies: 16
Views: 172

Re: Convert string to hex for registry

Example:

Code: Select all

D:\scripts> [System.Text.Encoding]::Unicode.GetBytes('12345')|%{[System.Convert]::ToString($_,16)
31
0
32
0
33
0
34
0
35
0
by jvierra
Fri Apr 21, 2017 11:59 am
Forum: Windows PowerShell
Topic: Convert string to hex for registry
Replies: 16
Views: 172

Re: Convert string to hex for registry

The code I posted will do exactly what you have asked. If you keep changing the rules then it is unlikely that any answer will satisfy what you are trying to do. Why would you need to do this. Use the printer API to configure the settings. There is generally never any need to do any conversions. Jus...
by jvierra
Fri Apr 21, 2017 11:28 am
Forum: Windows PowerShell
Topic: Convert string to hex for registry
Replies: 16
Views: 172

Re: Convert string to hex for registry

When dealing with hex specified values;

Convert the string to Unicode then convert it to hex a hex array.

[System.Text.Encoding]::Unicode.GetBytes('011')|%{[System.Convert]::ToString($_,16)}
by jvierra
Fri Apr 21, 2017 10:36 am
Forum: Windows PowerShell
Topic: Convert string to hex for registry
Replies: 16
Views: 172

Re: Convert string to hex for registry

To convert a string to a Unicode byte array:

[System.Text.Encoding]::Unicode.GetBytes('011')
by jvierra
Fri Apr 21, 2017 10:33 am
Forum: Windows PowerShell
Topic: Convert string to hex for registry
Replies: 16
Views: 172

Re: Convert string to hex for registry

Code: Select all

D:\scripts> $stringBytes="48,00,49,00,49,00"
D:\scripts> $bytes = $stringBytes -split ',' | %{ [int]$_}
D:\scripts> [System.Text.Encoding]::Unicode.GetString($bytes)
011
D:\scripts>

Go to advanced search