Bobby Llih
asked on
PowerShell - Pass Multiple Elements To Array Arguments In Function
I need help passing elements to array arguments in function.
I have current script that will, accept hard-coded elements. This will change the grid color to black in Windows 7 task Manager.
This script does nothing? It will print the arguments, though.
Can someone please help?
Many thanks in advance. (Apologies for confusion, new to PowerShell)
I have current script that will, accept hard-coded elements. This will change the grid color to black in Windows 7 task Manager.
$Bytes = [System.IO.File]::ReadAllBytes("C:\Windows\System32\taskmgr.exe")
$Offsets = @(0x0000B387, 0x0000FB84)
[Byte[]] $Hex_Color_Bytes = 0x00, 0x00, 0x00
For ($i = 0; $i -lt $Offsets.Length; $i++)
{
For ($j = 0; $j -lt $Hex_Color_Bytes.Length; $j++)
{
$Bytes[$Offsets[$i]++] = $Hex_Color_Bytes[$j]
}
}
[System.IO.File]::WriteAllBytes("C:\Windows\System32\taskmgr.exe", $Bytes)
This script does nothing? It will print the arguments, though.
$Bytes = [System.IO.File]::ReadAllBytes("C:\Windows\System32\taskmgr.exe")
Function Hex_Change_Colors([Array]$Offsets, [Byte[]]$Hex_Color_Bytes)
{
For ($i = 0; $i -lt $Offsets.Length; $i++)
{
For ($j = 0; $j -lt $Hex_Color_Bytes.Length; $j++)
{
$Bytes[$Offsets[$i]++] = $Hex_Color_Bytes[$j]
}
}
# Write-Host $Offsets, $Hex_Color_Bytes
}
Hex_Change_Colors 0x0000B387, 0x0000FB84, 0x00, 0xFF, 0x00
[System.IO.File]::WriteAllBytes("C:\Windows\System32\taskmgr.exe", $Bytes)
Can someone please help?
Many thanks in advance. (Apologies for confusion, new to PowerShell)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER