Terminal Services Session Instance name meaning - performance

In Windows Performance Monitor, what is the meaning of the numbers in Terminal Services Session > WorkingSet counter Instance field? I can see that some instances are named RDP-Tcp {Number} and others {Number} Down.
I assumed that, for the latter, the number would be the SessionID of a user session, but I can't retrieve a user session in powershell using get-rdusersession -computername {pc}|? sessionid -eq {Number}.
I'd like to better understand what are the " Down" sessions and how to find out which session it relates to.
Note: Besides {Number} Down, I see other sessions with instance names {Number} Up and {Number} Disk

Related

Trigger indefinite notification on Windows 10

I'm trying to trigger a notification which has no expiry but must be closed by pressing the top-right X close button. Is this possible?
I've been able to trigger a timed notification which also closes when anywhere else is clicked. With this answer.
[reflection.assembly]::loadwithpartialname("System.Windows.Forms")
[reflection.assembly]::loadwithpartialname("System.Drawing")
$notify = new-object system.windows.forms.notifyicon
$notify.icon = [System.Drawing.SystemIcons]::Information
$notify.visible = $true
$notify.showballoontip(10,"New Chat!","You have received New Chat!",[system.windows.forms.tooltipicon]::None)
Per Microsofts NotifyIcon.ShowBalloonTip Method documentation, the actual timeout property is set by the current system settings.
Minimum and maximum timeout values are enforced by the operating system and are typically 10 and 30 seconds, respectively, however this can vary depending on the operating system. Timeout values that are too large or too small are adjusted to the appropriate minimum or maximum value. In addition, if the user does not appear to be using the computer (no keyboard or mouse events are occurring) then the system does not count this time towards the timeout.
According to a couple of more google searches, you can set the time for your profile through the Registry ( Regedit - HKEY_CURRENT_USER\Control Panel\Accessibility: MessageDuration - didn't work for me).
Through group policy, or using theSystemParametersInfo API which is out of my league to explain any further. Only reference I can find was configuring the Accessibility/System Parameter: SPI_SETMESSAGEDURATION.
Its C++ though and only other article I could find was this one:SystemParametersInfoA function.
Seems possible but, it will definitely be a hassle to get it working.

Access denied calling EnumJobs

I'm trying to get the domain username of jobs in a printer queue on Windows Server 2012 R2 Standard. Code snippet below is in Delphi. OpenPrinter and EnumJobs are part of the Windows Spooler API.
Update! Setting maxJobs to a higher multiple of 4 allows for more jobs in the queue to be enumerated. eg. Setting maxJobs=8 allows for two jobs, but not three. maxJobs=12 allows for three jobs.
Solved! It looks like I can just ignore the return value of EnumJobs, and simply see if the number of jobs it returns > 0 (the last argument when calling). This seems to work fine for all instances listed below, including printer via a share.
const
maxJobs = 4;
var
h : THandle;
jia : array [1..maxJobs] of JOB_INFO_1;
jiz, jic : DWord; // size of jia, count of jia
begin
if OpenPrinter('DocTest', h, nil) then
begin
if EnumJobs(h, 0, maxJobs, 1, #jia, SizeOf(jia), jiz, jic) then
[...]
EnumJobs returns true or false depending on different conditions listed below. If it returns false in any of the following situations, the error message I'm retrieving is "System Error. Code: 5. Access is denied".
Clearly a permissions problem. I have assigned Print, Manage this Printer, and Manage documents to Everyone in the printer security settings. All jobs have been submitted after those settings have been assigned. My program is running in a session logged in as the domain administrator.
EnumJobs returns TRUE if I print a job from the same session I'm running this program in, and there's only one job in the queue. (See Update above for change)
EnumJobs returns TRUE if I print from another session on the server (it has terminal services installed) as any user, and there's only one job in the queue. (See Update above for change)
EnumJobs returns FALSE if there is more than one job in the queue. It doesn't matter if the jobs are for the same user or not. (See Update above for change)
EnumJobs returns FALSE if I print a job from another server to the printer share. Both servers are in the same domain. It doesn't matter which user prints the job, including the domain administrator.
What's going on here, in particular getting an access denied when enumerating more than (maxJobs / 4) job(s) at a time?
Ignore the return value of EnumJobs and inspect the out argument pcReturned to see if it's greater than 0. This indicates the number of print jobs found.

Detaching disk from stopped instance

I am trying to detach a disk from a stopped instance which is currently holding the disk. here's how I am doing it currently.
def detach_disk_from_instance(disk_name, zone=GCLOUD_ZONE):
disk_info = get_disk_info(disk_name=disk_name, zone=zone)
if disk_info.get('users'):
instance_name = disk_info['users'][0].rsplit('/').pop()
logger.info("detatching disk : {} from instance : {}".format(disk_name, instance_name))
request = compute.instances().detachDisk(
project=GCLOUD_PROJECT_NAME, zone=zone, instance=instance_name, deviceName=disk_name)
return make_http_request(request, {})
def wait_for_operation(operation, zone=GCLOUD_ZONE, worker=1):
logger.info('Waiting for operation {} to finish...'.format(operation))
with ThreadPoolExecutor(worker) as executor:
future = executor.submit(_check_operation_status, operation=operation, zone=zone)
wait([future])
return future.result()
req = detach_disk_from_instance(disk_name='test-disk')
wait_for_operation(operation=req['name'])
above code works if instance which is holding the disk is currently running.
but it doesn't work if instance is stopped. I get the following error when I try to detach disk from a stopped instance.
{'errors': [{'message': "No attached disk found with device name
'test-disk'", 'code': 'INVALID_USAGE'}]}
and I assure you that disk is still attached to the instance and gcp dashboard also shows that.
TL;DR - You're passing the name of the disk resource instead of the device name by which the disk is attached to the instance.
In the instances.attachDisk request to attach a disk to a VM instance you can specify the device name in the deviceName field of the request.
deviceName
string
Specifies a unique device name of your choice that
is reflected into the /dev/disk/by-id/google-* tree of a Linux
operating system running within the instance. This name can be used to
reference the device for mounting, resizing, and so on, from within
the instance.
If not specified, the server chooses a default device name to apply to
this disk, in the form persistent-disks-x, where x is a number
assigned by Google Compute Engine. This field is only applicable for
persistent disks.
You will need to use this name as the deviceName query parameter for the instances.detachDisk request.
Required query parameters
deviceName
string
Disk device name to detach.
As mentioned in the doc, if you did not specify a device name while attaching the disk GCE generates a device name in the form persistent-disks-x and you will have to specify this name.

SNMPv3 user entries got deleted after reboot on SNMPv3 machine

After reboot on our SNMPv3 server SNMPv3 user entries get deleted from file /var/net-snmp/snmpd.conf.
It appears on doing reboot engineBoots is set to 1 in /var/net-snmp/snmpd.conf randomly and whenever engineBoot is set to 1 it erases snmpv3 user entries from snmpd.conf file.
Firstly, I want to understand why engineBoots vaule is randomly set to 1, As per standard snmp document , this EngineBoots should be incremented every time we do reboot or EngineTime exceeded the max value.
Secondly, we want to figure out the correlation of engineBoots vaule setting to 1 and the deletion of usmUser entries in /var/net-snmp/snmpd.conf.
Thanks-Ravi
It is normal behavior. Once snmpd is restarted, the create user command line will be deleted from /var/net-snmp/snmpd.conf for security reason and the user will be created in usmUsertable.

stale session data - websphere

I'm having a stale attribute with the http session within Websphere 6 and may be related to in memory session replication..
Steps:
Object A.0 - Placed into the session with ID "ABC"
Remove A.0 from the session..
Object A.1 (New instance) - placed into Session with ID "ABC"
retrieve object with ID "ABC" from the session - RESULT: A.1 (Correct)
carry out a Servlet forward or a redirect (issues seen on both functions)..
retrieve "ABC" from the session - RESULT: A.0, the object that was removed from the session..
Notes -
Same Session object (hashcode/session ID) used in steps 1-5 using in
memory replication across 2 JVMs (single cluster)
time duration between steps 2 & 5 is total of 4 seconds
No other external threads have accessed the session in the interim..
Only noticed for 1 specific use-case; haven't encountered this in
other use-cases..
Anyone seen anything like this before where a stale data is being returned from the websphere application server?
Thanks,
Ian.
Are you explicitly writing the changed object back to the session before you forward/redirect? In at least some versions of WebSphere, in some configurations, you must do this to ensure the change is "committed".
(If I find a clear reference for this, I'll update my answer.)

Resources