inf2cat 22.9.10 error - inf

I'm trying to sign old Hitachi driver that makes USB flash drive appear as fixed disk
(Quite useful when you have fast, large thumb drives)
Driver itself works fine but I constantly get same error when try to get it signed:
Errors:
22.9.10: cfadisk.sys in [cfadisk_copyfiles] is missing from [SourceDisksFiles] section in
\cfadisk.inf; driver may not sign correctly until this is resolved.
22.9.10: disk.sys in [gendisk_copyfiles] is missing from [SourceDisksFiles] section in
cfadisk.inf; driver may not sign correctly until this is resolved.
This is my .inf file:
[Version]
Signature="$Windows NT$"
Class=DiskDrive
ClassGuid={4D36E967-E325-11CE-BFC1-08002BE10318}
Provider=%HGST%
DriverVer=10/14/2012,9.9.9.9
CatalogFile=cfadisk.cat
[Manufacturer]
%HGST% = cfadisk_device,ntAMD64
[DestinationDirs]
cfadisk_copyfiles=12 ; %SystemRoot%\system32\drivers
gendisk_copyfiles=12 ; %SystemRoot%\system32\drivers
[cfadisk_copyfiles]
cfadisk.sys
[gendisk_copyfiles]
disk.sys
[cfadisk_device]
%Microdrive_devdesc% = cfadisk_install,USBSTOR\Disk&Ven_SanDisk&Prod_Extreme&Rev_0001
[cfadisk_device.NTamd64]
%Microdrive_devdesc% = cfadisk_install,USBSTOR\Disk&Ven_SanDisk&Prod_Extreme&Rev_0001
[cfadisk_addreg]
HKR,,"LowerFilters",0x00010008,"cfadisk"
[cfadisk_install]
CopyFiles=cfadisk_copyfiles,gendisk_copyfiles
[cfadisk_install.HW]
AddReg=cfadisk_addreg
[cfadisk_install.Services]
AddService=disk,2,gendisk_ServiceInstallSection
AddService=cfadisk,,cfadisk_ServiceInstallSection
[gendisk_ServiceInstallSection]
DisplayName = "Disk Driver"
ServiceType = 1
StartType = 0
ErrorControl = 1
ServiceBinary = %12%\disk.sys
LoadOrderGroup = SCSI Class
[cfadisk_ServiceInstallSection]
DisplayName = "CompactFlash Filter Driver"
ServiceType = 1
StartType = 3
ErrorControl = 1
ServiceBinary = %12%\cfadisk.sys
LoadOrderGroup = Pnp Filter
; -----------------------
[Strings]
HGST = "Hitachi"
Microdrive_devdesc = "SanDisk Extreme"
I was using this tutorial as reference point:
http://www.deploymentresearch.com/Blog/tabid/62/EntryId/63/Sign-your-unsigned-drivers-Damn-It.aspx
cfadisk.inf and sys can be downloaded here:
link is at the beginning of first post
http://hardforum.com/showthread.php?t=1655684
Any help would be greatly appreciated
EDIT:
I just used chkinf utility on this .inf file
Here is the output:
C:\DriversCert\SanDisk\cfadisk.inf: FAILED
NTLOG REPORT--------------
Total Lines: 62 |
Total Errors: 1 |
Total Warnings: 4 |
--------------------------
Line 0: ERROR: (E22.1.1003) Section [SourceDisksNames] not defined.
Line 0: WARNING: (W22.1.2212) No Copyright information found.
Line 0: WARNING: (W22.1.2111) [SourceDisksFiles] section not defined - full CopyFiles checking not done.
Line 17: WARNING: (W22.1.2112) File "cfadisk.sys" is not listed in the [SourceDisksFiles].
Line 20: WARNING: (W22.1.2112) File "disk.sys" is not listed in the [SourceDisksFiles].
I'm really no programer so I really don't understand what does all this mean.
Strange thing is that driver does work, I just can't get i signed.
Thank you!
Best regards,
Walter

It means that some sections are missed. In your case they are [SourceDisksFiles] and [SourceDisksNames]
In this specific situation you just should add:
[SourceDisksFiles]
cfadisk.sys = 1
disk.sys = 1
[SourceDisksNames]
1 = %DiskName%, ,
and also add a record to [String] section in the bottom:
DiskName="Disk Drive"

Related

Powershell Hex, Int and Bit flag checking

I am trying to process a flag from the MECM command Get-CMTaskSequenceDeployment called 'AdvertFlags'.
The information from Microsoft in relation to this value is HERE
The value returned is designated as : Data type: UInt32
In the table of flags, the one I need to check is listed as :
Hexadecimal (Bit)
Description
0x00000020 (5)
IMMEDIATE. Announce the advertisement to the user immediately.
As part of my Powershell script I am trying to ascertain if this flag is set.
I can see by converting it to Binary that a particular bit gets set.
When the settings is enabled:
DRIVE:\> [convert]::ToString((Get-CMTaskSequenceDeployment -AdvertisementID ABC20723).AdvertFlags, 2)
100110010000000000100000
When the setting is disabled:
DRIVE:\> [convert]::ToString((Get-CMTaskSequenceDeployment -AdvertisementID ABC20723).AdvertFlags, 2)
100110010000000000000000
The 6th bit is changed. Great! So far though, I've been unable to find a way to check if this bit is set. I suspected something in the bitwise operators (-band -bor etc) would help me here but I've been unable to get it to work.
Any bitwise operation I try returns an error:
"System.UInt64". Error: "Value was either too large or too small for a UInt64."
I mean, I can compare the string literally, but other options may be changed at any point.
Any help greatly appreciated.
EDIT: Just as an example of the error I am seeing, I can see that the bit that is set is '32' and from my limited understanding I should be able to:
PS:\> '100110010000000000100000' -band '32'
Cannot convert value "100110010000000000100000" to type "System.UInt64". Error: "Value was either too large or too small for a UInt64."
At line:1 char:1
+ '100110010000000000100000' -band '32'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvalidCastIConvertible
But I just always return an error
To test bit6 in
$AdvertFlags = (Get-CMTaskSequenceDeployment -AdvertisementID ABC20723).AdvertFlags
Should simply be:
if ($AdvertFlags -band 32) { 'bit6 is set' } else { 'bit6 is not set' }
I do not have access to a deployment environment with Get-CMTaskSequenceDeployment cmdlet, nevertheless to confirm what I am stating:
$AdvertFlags = [Convert]::ToUInt32("100110010000000000100000", 2)
$AdvertFlags
10027040
if ($AdvertFlags -band 32) { 'bit6 is set' } else { 'bit6 is not set' }
bit6 is set
$AdvertFlags = [Convert]::ToUInt32("100110010000000000000000", 2)
$AdvertFlags
10027008
if ($AdvertFlags -band 32) { 'bit6 is set' } else { 'bit6 is not set' }
bit6 is not set
Your self-answer using [bigint]'100110010000000000100000' -band "32" to test for bit6 is merely a coincident that it returns the expected value:
10027035..10027045 |ForEach-Object {
$Binary = [convert]::ToString($_, 2)
[pscustomobject]#{
Binary = $Binary
bAnd = $_ -bAnd 32
Bigint = [bigint]$Binary -band "32"
}
}
Yields:
Binary bAnd Bigint
------ ---- ------
100110010000000000011011 0 0
100110010000000000011100 0 0
100110010000000000011101 0 0
100110010000000000011110 0 32 # ← incorrect
100110010000000000011111 0 32 # ← incorrect
100110010000000000100000 32 32
100110010000000000100001 32 32
100110010000000000100010 32 32
100110010000000000100011 32 32
100110010000000000100100 32 0 # ← incorrect
100110010000000000100101 32 0 # ← incorrect
enumerations as flags
But PowerShell has an even nicer way to test them by name:
[Flags()] enum AdvertFlags {
IMMEDIATE = 0x00000020 # Announce the advertisement to the user immediately.
ONSYSTEMSTARTUP = 0x00000100 # Announce the advertisement to the user on system startup.
ONUSERLOGON = 0x00000200 # Announce the advertisement to the user on logon.
ONUSERLOGOFF = 0x00000400 # Announce the advertisement to the user on logoff.
OPTIONALPREDOWNLOAD = 0x00001000 # If the selected architecture and language matches that of the client, the package content will be downloaded in advance
WINDOWS_CE = 0x00008000 # The advertisement is for a device client.
ENABLE_PEER_CACHING = 0x00010000 # This information applies to System Center 2012 Configuration Manager SP1 or later, and System Center 2012 R2 Configuration Manager or later.
DONOT_FALLBACK = 0x00020000 # Do not fall back to unprotected distribution points.
ENABLE_TS_FROM_CD_AND_PXE = 0x00040000 # The task sequence is available to removable media and the pre-boot execution environment (PXE) service point.
APTSINTRANETONLY = 0x00080000 #
OVERRIDE_SERVICE_WINDOWS = 0x00100000 # Override maintenance windows in announcing the advertisement to the user.
REBOOT_OUTSIDE_OF_SERVICE_WINDOWS = 0x00200000 # Reboot outside of maintenance windows.
WAKE_ON_LAN_ENABLED = 0x00400000 # Announce the advertisement to the user with Wake On LAN enabled.
SHOW_PROGRESS = 0x00800000 # Announce the advertisement to the user showing task sequence progress.
NO_DISPLAY = 0x02000000 # The user should not run programs independently of the assignment.
ONSLOWNET = 0x04000000 # Assignments are mandatory over a slow network connection.
TARGETTOWINPE = 0x10000000 # Target this deployment to WinPE only.
HIDDENINWINPE = 0x20000000 # Target this deployment to WinPE only but hide in WinPE. It can only be used by TS variable SMSTSPreferredAdvertID.
}
# $AdvertFlags = [AdvertFlags](Get-CMTaskSequenceDeployment -AdvertisementID ABC20723).AdvertFlags
$AdvertFlags = [AdvertFlags][Convert]::ToUInt32("100110010000000000100000", 2)
# or: $AdvertFlags = [AdvertFlags]('IMMEDIATE', 'ENABLE_PEER_CACHING', 'APTSINTRANETONLY', 'OVERRIDE_SERVICE_WINDOWS', 'SHOW_PROGRESS')
$AdvertFlags
IMMEDIATE, ENABLE_PEER_CACHING, APTSINTRANETONLY, OVERRIDE_SERVICE_WINDOWS, SHOW_PROGRESS
$AdvertFlags -bAnd [AdvertFlags]'IMMEDIATE'
IMMEDIATE
EDIT: My answer here is incorrect as noted above. Leaving here for prosperity!
As always I BELEIVE I found the answer minutes after posting (After spending a couple hours on this!).
By adjusting the type to [bigint] the comparison was able to complete and return the expected answer:
DRIVE:\> [bigint]'100110010000000000100000' -band "32"
32
So a simple:
If (([bigint]'100110010000000000100000' -band "32") -gt 0){$true}else{$false}
True
and:
If (([bigint]'100110010000000000000000' -band "32") -gt 0){$true}else{$false}
False
Solves my issue. Feel free to give any extra advice if this is not the ideal way to proceed.
I though PS would be smarted when auto defining types etc. This is targeting PS5 on Server 2012 R2 though.

Save job output from SDSF into a PDS and using ISPF functions in REXX

We periodically runs jobs and we need to save the output into a PDS and then parse the output to extract parts of it to save into another member. It needs to be done by issuing a REXX command using the percent sign and the REXX member name as an SDSF command line. I've attempted to code a REXX to do this, but it is getting an error when trying to invoke an ISPF service, saying the ISPF environment has not been established. But, this is SDSF running under ISPF.
My code has this in it (copied from several sources and modified):
parse arg PSDSFPARMS "(" PUSERPARMS
parse var PSDSFPARMS PCURRPNL PPRIMPNL PROWTOKEN PPRIMCMD .
PRIMCMD=x2c(PPRIMCMD)
RC = isfquery()
if RC <> 0 then
do
Say "** SDSF environment does not exist, exec ending."
exit 20
end
RC = isfcalls("ON")
Address SDSF "ISFGET" PPRIMPNL "TOKEN('"PROWTOKEN"')" ,
" (" VERBOSE ")"
LRC = RC
if LRC > 0 then
call msgrtn "ISFGET"
if LRC <> 0 then
Exit 20
JOBNAME = value(JNAME.1)
JOBNBR = value(JOBID.1)
SMPDSN = "SMPE.*.OUTPUT.LISTINGS"
LISTC. = ''
SMPODSNS. = ''
SMPODSNS.0 = 0
$ = outtrap('LISTC.')
MSGVAL = msg('ON')
address TSO "LISTC LVL('"SMPDSN"') ALL"
MSGVAL = msg(MSGVAL)
$ = outtrap('OFF')
do LISTCi = 1 to LISTC.0
if word(LISTC.LISTCi,1) = 'NONVSAM' then
do
parse var LISTC.LISTCi . . DSN
SMPODSNS.0 = SMPODSNS.0 + 1
i = SMPODSNS.0
SMPODSNS.i = DSN
end
IX = pos('ENTRY',LISTC.LISTCi)
if IX <> 0 then
do
IX = pos('NOT FOUND',LISTC.LISTCi,IX + 8)
if IX <> 0 then
do
address ISPEXEC "SETMSG MSG(IPLL403E)"
EXITRC = 16
leave
end
end
end
LISTC. = ''
if EXITRC = 16 then
exit 0
address ISPEXEC "TBCREATE SMPDSNS NOWRITE" ,
"NAMES(TSEL TSMPDSN)"
I execute this code by typing %SMPSAVE next to the spool output line on the "H" SDSF panel and it runs fine until it gets to this point in the REXX:
114 *-* address ISPEXEC "TBCREATE SMPDSNS NOWRITE" ,
"NAMES(TSEL TSMPDSN)"
>>> "TBCREATE SMPDSNS NOWRITE NAMES(TSEL TSMPDSN)"
ISPS118S SERVICE NOT INVOKED. A VALID ISPF ENVIRONMENT DOES NOT EXIST.
+++ RC(20) +++
Does anyone know why it says I don't have a valid ISPF environment and how I can get around this?
I've done quite a bit in the past with REXX, including writing REXX code to handle line commands, but this is the first time I've tried to use ISPEXEC commands within this code.
Thank you,
Alan

Converting Output to CSV and Out-Grid

I have a file as below.
I want it to convert it to CSV and want to have the out grid view of it for items Drives,Drive Type,Total Space, Current allocation and Remaining space only.
PS C:\> echo $fileSys
Storage system address: 127.0.0.1
Storage system port: 443
HTTPS connection
1: Name = Extreme Performance
Drives = 46 x 3.8T SAS Flash 4
Drive type = SAS Flash
RAID level = 5
Stripe length = 13
Total space = 149464056594432 (135.9T)
Current allocation = 108824270733312 (98.9T)
Remaining space = 40639785861120 (36.9T)
I am new to Powershell but I have tried below code for two of things but it's not even getting me desired output.
$filesys | ForEach-Object {
if ($_ -match '^.+?(?<Total space>[0-9A-F]{4}\.[0-9A-F]{4}\.[0-9A-F]{4}).+?(?<Current allocation>\d+)$') {
[PsCustomObject]#{
'Total space' = $matches['Total space']
'Current allocation' = $matches['Current allocation']
}
}
}
First and foremost, the named capture groups cannot contain spaces.
From the documentation
Named Matched Subexpressions
where name is a valid group name, and subexpression is any valid
regular expression pattern. name must not contain any punctuation
characters and cannot begin with a number.
Assuming this is a single string since your pattern attempts to grab info from multiple lines, you can forego the loop. However, even with that corrected, your pattern does not appear to match the data. It's not clear to me what you are trying to match or your desired output. Hopefully this will get you on the right track.
$filesys = #'
Storage system address: 127.0.0.1
Storage system port: 443
HTTPS connection
1: Name = Extreme Performance
Drives = 46 x 3.8T SAS Flash 4
Drive type = SAS Flash
RAID level = 5
Stripe length = 13
Total space = 149464056594432 (135.9T)
Current allocation = 108824270733312 (98.9T)
Remaining space = 40639785861120 (36.9T)
'#
if($filesys -match '(?s).+total space\s+=\s(?<totalspace>.+?)(?=\r?\n).+allocation\s+=\s(?<currentallocation>.+?)(?=\r?\n)')
{
[PsCustomObject]#{
'Total space' = $matches['totalspace']
'Current allocation' = $matches['currentallocation']
}
}
Total space Current allocation
----------- ------------------
149464056594432 (135.9T) 108824270733312 (98.9T)
Edit
If you just want the values in the parenthesis, modifying to this will achieve it.
if($filesys -match '(?s).+total space.+\((?<totalspace>.+?)(?=\)).+allocation.+\((?<currentallocation>.+?)(?=\))')
{
[PsCustomObject]#{
'Total space' = $matches['totalspace']
'Current allocation' = $matches['currentallocation']
}
}
Total space Current allocation
----------- ------------------
135.9T 36.9T
$unity=[Regex]::Matches($filesys, "\(([^)]*)\)") -replace '[(\)]','' -replace "T",""
$UnityCapacity = [pscustomobject][ordered] #{
Name = "$Display"
"Total" =$unity[0]
"Used" = $unity[1]
"Free" = $unity[2]
'Used %' = [math]::Round(($unity[1] / $unity[0])*100,2)
}``

register multiple instances of application in the same host to same Net-SNMP agent

I've been struggling with this for a couple of days, and none of the solutions I've found work the way I'd like (I can be completely wrong, I've not used SNMP for a very long time, though).
This is existing code in my company, a perl application that connects to net-snmp agentx using POE::Component::NetSNMP::Agent. MIB defined for this application is defined, with base oid finished in .154. The MIB file defines 3 tables on it: status (.1), statistics (.2) and performance (.3). Everything works fine, registration with the agent goes fine, snmpwalk shows data being updated, etc.
But now a requirement has been implemented, allowing multiple (up to 32) instances of the application running in the same host. And monitoring shall be supported too, which brings the first issue: when connecting to agentX more than once, with the same OID, only one instance connects, and the others are refused.
I've though to make something like this:
.154
.1 (instance 1):
.1 (status table)
.2 (statistics table)
.3 (performance table)
.2 (instance 2):
.1 (status table)
.2 (statistics table)
.3 (performance table)
.3 (instance 3):
.1 (status table)
.2 (statistics table)
.3 (performance table)
[...]
.32 (instance 32):
.1 (status table)
.2 (statistics table)
.3 (performance table)
With this approach, each instance (they know their own id) can register to AgentX with no problems (nice!). Following the model above, tables for status, statistics and performance would be common to all instances.
querying to .154 would show the model above.
querying data for each specific instance by walking to .154.1, .154.2, etc would be possible too.
But I'm unable to get this running properly, as smlint, snmpwalk and iReasoning moan about different data types expected, data is not being shown the right way, etc.
What I've tried so far:
arrays: main index per instance, subindex on status, statistics and performance indexed with { main index, subindex}. Like this: SNMP: ASN.1 MIB Definitions. Referencing a table within a table.
Multiple definitions: re-define every table and component for the 32 instances, with different indices on names. It works moreover, but not exactly the way I was expecting: an snmpwalk of the parent does not show any child, so snmpwalk must be performed using . . . . .154.1, . . . . . .154.2, etc.
I've considered this solution as well: Monitoring multiple java processes on the same host via SNMP. But in my case does not work, as the instances connect to a common agent, they don't have their own agent running in a different port.
I have to admit I'm running out of ideas. Again, I could be completely wrong and could be facing the problem from a wrong perspective.
Is it possible to implement this the way I'm looking for? In SNMPv3 this could possibly be a good use for contexts, but they are not available in net-snmp to my knowledge.
edit
Solution number two, from my list above, is the one working better by far.
From parent MIB, 32 new child OIDs are defined:
sampleServer MODULE-IDENTITY
LAST-UPDATED "201210101200Z"
[...]
DESCRIPTION "Sample Server MIB module"
REVISION "201211191200Z" -- 19 November 2012
DESCRIPTION "Version 0.1"
::= { parentMibs 154 }
instance1 OBJECT IDENTIFIER ::= { sampleServer 1 }
instance2 OBJECT IDENTIFIER ::= { sampleServer 2 }
instance3 OBJECT IDENTIFIER ::= { sampleServer 3 }
instance4 OBJECT IDENTIFIER ::= { sampleServer 4 }
instance5 OBJECT IDENTIFIER ::= { sampleServer 5 }
instance6 OBJECT IDENTIFIER ::= { sampleServer 6 }
[...]
And tables are repeated for each instanceId, a python script wrote the big MIB file for this (I know,
-- the table contains static information for instance number 1
-- this includes version, start time etc
sampleStatusTable1 OBJECT-TYPE
SYNTAX SEQUENCE OF sampleStatusEntry1
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION "sample Server instance1 Status, table"
::= { instance1 1 }
[...]
-- this table contains statistics and sums that change constantly
-- please note that depending on sample_server configuraiton not all
-- of these will be filled in
sampleStatisticsTable1 OBJECT-TYPE
SYNTAX SEQUENCE OF sampleStatisticsEntry1
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION "sample Server Statistics, table"
::= { instance1 2 }
[...]
-- performance figures that reflect the current load of sample_server
samplePerformanceTable1 OBJECT-TYPE
SYNTAX SEQUENCE OF samplePerformanceEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION "sample Server Performance, table"
::= { instance1 3 }
[...]
snmpwalk output for each instance:
snmpwalk -M +/opt/sample_server/docs/mibs -m +COMPANY-SAMPLE-MIB -v2c -cpublic localhost 1.3.6.1.1.1.2.154.1
COMPANY-SAMPLE-MIB::sampleStatusInstance1 = INTEGER: 1
COMPANY-SAMPLE-MIB::sampleStatusVersion1 = STRING: "3.58"
COMPANY-SAMPLE-MIB::sampleStatusStartTime1 = STRING: "2014-12-13T00:06:27+0000"
COMPANY-SAMPLE-MIB::sampleStatisticsInstance1 = INTEGER: 1
COMPANY-SAMPLE-MIB::sampleStatisticsHTTPInputTransactions1 = INTEGER: 0
COMPANY-SAMPLE-MIB::sampleStatisticsHTTPInputErrors1 = INTEGER: 0
COMPANY-SAMPLE-MIB::sampleStatisticsHTTPOutputTransactions1 = INTEGER: 0
COMPANY-SAMPLE-MIB::sampleStatisticsHTTPOutputErrorsRecoverable1 = INTEGER: 0
COMPANY-SAMPLE-MIB::sampleStatisticsHTTPOutputErrors1 = INTEGER: 0
COMPANY-SAMPLE-MIB::sampleStatisticsEntry1.7 = INTEGER: 0
COMPANY-SAMPLE-MIB::samplePerformanceInstance1 = INTEGER: 1
COMPANY-SAMPLE-MIB::samplePerformanceQueueLoad1 = INTEGER: 0
COMPANY-SAMPLE-MIB::samplePerformanceThroughput1 = INTEGER: 0
snmpwalk -M +/opt/sample_server/docs/mibs -m +COMPANY-SAMPLE-MIB -v2c -cpublic localhost 1.3.6.1.1.1.2.154.2
COMPANY-SAMPLE-MIB::sampleStatusInstance2 = INTEGER: 1
COMPANY-SAMPLE-MIB::sampleStatusVersion2 = STRING: "3.58"
COMPANY-SAMPLE-MIB::sampleStatusStartTime2 = STRING: "2014-12-13T00:06:27+0000"
COMPANY-SAMPLE-MIB::sampleStatisticsInstance2 = INTEGER: 1
COMPANY-SAMPLE-MIB::sampleStatisticsHTTPInputTransactions2 = INTEGER: 0
COMPANY-SAMPLE-MIB::sampleStatisticsHTTPInputErrors2 = INTEGER: 0
COMPANY-SAMPLE-MIB::sampleStatisticsHTTPOutputTransactions2 = INTEGER: 0
COMPANY-SAMPLE-MIB::sampleStatisticsHTTPOutputErrorsRecoverable2 = INTEGER: 0
COMPANY-SAMPLE-MIB::sampleStatisticsHTTPOutputErrors2 = INTEGER: 0
COMPANY-SAMPLE-MIB::sampleStatisticsEntry2.7 = INTEGER: 0
COMPANY-SAMPLE-MIB::samplePerformanceInstance2 = INTEGER: 1
COMPANY-SAMPLE-MIB::samplePerformanceQueueLoad2 = INTEGER: 0
COMPANY-SAMPLE-MIB::samplePerformanceThroughput2 = INTEGER: 0
But the result it's not as good as I was expecting, because a snmpwalk to master .154 shows the status for .154.1, instead of showing for every instance. Not sure if this is the expected behavior.
snmpwalk -M +/opt/sample_server/docs/mibs -m +COMPANY-SAMPLE-MIB -v2c -cpublic localhost 1.3.6.1.1.1.2.154
COMPANY-SAMPLE-MIB::sampleStatusInstance1 = INTEGER: 1
COMPANY-SAMPLE-MIB::sampleStatusVersion1 = STRING: "3.58"
COMPANY-SAMPLE-MIB::sampleStatusStartTime1 = STRING: "2014-12-13T00:06:27+0000"
COMPANY-SAMPLE-MIB::sampleStatisticsInstance1 = INTEGER: 1
COMPANY-SAMPLE-MIB::sampleStatisticsHTTPInputTransactions1 = INTEGER: 0
COMPANY-SAMPLE-MIB::sampleStatisticsHTTPInputErrors1 = INTEGER: 0
COMPANY-SAMPLE-MIB::sampleStatisticsHTTPOutputTransactions1 = INTEGER: 0
COMPANY-SAMPLE-MIB::sampleStatisticsHTTPOutputErrorsRecoverable1 = INTEGER: 0
COMPANY-SAMPLE-MIB::sampleStatisticsHTTPOutputErrors1 = INTEGER: 0
COMPANY-SAMPLE-MIB::sampleStatisticsEntry1.7 = INTEGER: 0
COMPANY-SAMPLE-MIB::samplePerformanceInstance1 = INTEGER: 1
COMPANY-SAMPLE-MIB::samplePerformanceQueueLoad1 = INTEGER: 0
COMPANY-SAMPLE-MIB::samplePerformanceThroughput1 = INTEGER: 0

Preform a bitwise to decode a syslog priority code

I'm trying figure how to decode a syslog priority code in powershell. I know the priority code is a combination of the facilty and severity of the message, and that the facility is mutiplied by 8 before being added to the severity code, but I'm not sure how to code this in Powershell.
So the priority of 37/8 = 4.625, which gives you a 4=Facility
and the priority of 37-(4*8)=5, which gives you a 5=Severity
The 4 Facility is a security/authorization message
The 5 Severity is a Notice: normal
All of this is outlined in the RFC 3164 (http://www.ietf.org/rfc/rfc3164.txt), but I'm not sure how I can do this decoding in Powershell code
try this (no bitwise):
function get-syslog {
param($pri)
[int]$facility = [Math]::truncate([decimal]($pri/8))
$severity = $pri - ($facility *8 )
"Facility is $facility - Severity is $severity"
}
use:
get-syslog -pri 23
Facility is 2 - Severity is 7