In the Windows USER_INFO_2 structure there are two fields: usri2_comment and usri2_usr_comment. (Similarly, USER_INFO_3 has usri3_comment and usri3_usr_comment, and USER_INFO_4 has usri4_comment and usri4_usr_comment.) The documentation explains that usri2_comment "contains a comment to associate with the user account" whereas usri2_usr_comment is "a Unicode string that contains a user comment". But it never makes clear what is the difference between the two – why are there two comment fields here? What is each supposed to be used for?
The NET USER command displays both in its output – it calls usri2_comment the "Comment", whereas usri2_usr_comment it calls the "User's comment". The former can be changed using the /COMMENT option whereas the later can be changed using the /USERCOMMENT option. But that still is unenlightening as to what the actual difference between them is.
The difference is:
usri2_comment is a comment set by the administrator. A non-administrator user cannot modify it even on their own account.
usri2_usr_comment is a comment set by the user themselves. A non-administrator can modify it on their own account only.
A user can set their own usri2_usr_comment by calling NetUserSetInfo on themselves using info level 1012 (create a USER_INFO_1012 structure and set the usri1012_usr_comment field to the new user comment).
Note however that, in my own testing, NET USER username /USERCOMMENT:comment, when run by a non-admin user on themselves, fails with an access denied error. I believe the reason for this is that the NET USER command is calling NetUserSetInfo with info level 2 (or 3 or 4) instead of 1012.
Related
I would like to know how to limit the number of nodes a single job can use by the account level on slurm.
sacctmgr modify account where name=test9_phase1 set MaxTRESPerJob=nodes=1
This doesnt seem to work, giving the error:
Unknown option: MaxTRESPerJob=nodes=1
Use keyword 'where' to modify condition
and I can't find anything in the documentation on how to do it.
If I could limit it by user that would also work, but again I get an error
sacctmgr modify user where cluster=linux account=test9_phase1 set maxTRESPerJob=nodes=1
Unknown option: maxTRESPerJob=nodes=1
Use keyword 'where' to modify condition
The correct option to set is MaxNodesPerJob. The sacctmgr output can be a bit misleading there.
So in your case, the correct command should be:
sacctmgr modify account where name=test9_phase1 set MaxNodesPerJob=1
I have a shell script provided by our admin to connect to HPC where I have to provide answers to various prompts every time I connect. Is there a way that I can put my answers in a text file and it provides the answers to the questions based on what question is asked? I tried other answers on SO but here the situation is different because our admin made the questions/options random and sometimes not all questions pop up. Therefor a static input like echo "y n y y y" won't work. Here is the full workflow.
I invoke the script as login.sh then prompt comes up
1) name1 2) name2 2) name3 4) name4
Please select an account:
then I select the number 1 to 4 based on which one I want to connect to. But let's say I always want to connect to name1, and I can simply do that by passing echo "1" | login.sh. However, the tricky part is that these accounts do not appear in the same order each time. Sometimes name1 is on 1, the next time on 4 and so on. It is random. How can I automate it in such a way that I always connect to name1?
Once I pass this first prompt then the next prompt similar to this one comes up
1) instance1
2) instance2
3) instance3
4) random
Please select an instance to connect to:
then again I fill in one numeric value 1 to 4. I always want to connect to random but similar to above, it doesn't always come at position 4. How can I do it?
These first couple of steps are numerical but then comes a bit more complex where it asks us to enter our user id and password.
What is your username?:
here I can either enter my user id or just press enter to continue. I would like to know how to do it both ways. Finally it asks for the password.
Password:
then I enter the password. Trick here is that sometimes it let's me login by only entering the password once, but sometime it asks for the password multiple times.
How can I provide these answers in a simple text file and pass this file to shell script as an argument maybe that it can detect which question is being asked and provide answers based on what question is being asked. I would really appreciate if I can get some guidance on this one.
I have a question concerning the use of presentation variables:
1) What's the correct syntax for filtering on a presentation variable is used? You allow a user to select multiple values in a filter eg. A and B. If you use the syntax = '#{PV}{%}' it will result in this sql: = 'A, B' which of course won't exist in the data. I'd like to have this result: in ('A', 'B').
I've already found this syntax: (#{PV}['#']) which gives the correct sql, only thing here is that this doesn't work when you have a dashboard prompt where you allow 'all column values'. When no value is passed to this presentation variable, the analysis throws an error. I have no idea how to put a default value in this one. Any ideas on this?
2) Is there any configuration or setting where you can push obi to use a presentation variable in stead of using the 'normal' way of filtering as shown here:
The obi way is that it changes the relation to the relation in the prompt (if the prompt says 'is greater than' it will change here as well, even though you've put here 'is equal to'), but it will also use a value for this dimension if there's ever been a value for this, rather than listening to the value in the presentation variable of the dashboard prompt. I know that you can translate this to SQL but that's not the way to go for me. The behaviour I'd like is (in this exact order):
- when there is a value in the presentation variable in the dashboard prompt, take this.
- when there is a value for this role of the dimension, take that.
The reason why is because we have this dimension 'Afdeling' which can take up many roles but our customer asked for the roles to be hidden from the end user. This means that even though you switch roles, the end user always sees 'Afdeling' and couldn't care less in which role it is looking at its 'Afdeling'. They can switch between different dashboard pages and if I'd put on top of the page the dashboardprompt of the 'Afdeling' in the role it needed to be, the value won't pass through when switching pages to another dashboardprompt of another role. That way the end user would know something was up. So the value needs to pass through the prompt on each page, no matter what the role of that dimension.
After a bit of googling I've found the answer to question 1 myself. Thanks to this website https://www.obieetips.com/2014/05/obiee-11g-using-multiple-value-for.html I now know that the correct syntax is (#{pv_region}['#']{'West '})
In vBulletin 4.2 the session table has a column loggedin. Since VB doesn't seem to have a official database documentation, I want to know what exactly it means because the column it's a SMALLINT instead of simple boolean value.
My previous reverse engineering: 0 means not logged in. 1 and 2 is used for logged in users, but I can't see what's the difference. I have both regular user session and admin panel sessions with loggedin=2.
Tried to get more information by running grep on vBulletins php files, without luck .
So my concrete questions are:
What is the difference between sessions with 1 and 2?
Are there more states than 0, 1 and 2?
Do they even matter when vBulletin's code doesn't seem to use them?
I learned that my filter to *.php files broke greps recursive scanning method. The correct command to scan all php files for 'loggedin' (in quotes since vB use them this way on it's $vbulletin->session object) is:
grep -rn --include \*.php "'loggedin'" .
This gave a few results. Most interesting:
./includes/functions.php:7558: $vbulletin->session->set('loggedin', 2);
Opening functions.php we see the call and we can feel lucky that at least in the code vB developers to decide that a comment would be usefull:
if ($vbulletin->session->vars['loggedin'] == 1 AND !$vbulletin->session->created)
{
# If loggedin = 1, this is out first page view after a login so change value to 2 to signify we are past the first page view
# We do a DST update check if loggedin = 1
$vbulletin->session->set('loggedin', 2);
// ...
}
So we can say that 1/2 doesn't gave information about the type of session. It could be a regular user or also admin session. Altough loggedin indicates if the user already viewed some other pages or not, whyever vB devs need to devide this.
I am writing a script to capture the login time. In the final production, there would be no input from any user. However I am testing it and I wanted to know how I add extra code to determine that
If its in 'debug' mode AND
The user that is logging in is me (lets say my username is joe.smith on the domain called EXAMPLE)
then present an input box to allow me to type the date, time for logging in.
All other users would never see this and it would capture today with the system time.
I would also like to hide the code so if the script is opened by the wrong person, they wouldnt be able to make heads or tails of whats going on.
You can use a command line parameter as Matt says to set the script into debug mode, eg
dim isdebug: isdebug = WScript.Arguments.Named.Exists("debug")
WScript.Echo("in debug mode: " & isdebug)
Which you can invoke with
wscript debugscript.vbs /debug
To get the current user name, you can use either the WMI Service or the WScript.Network object.
Once you have the username, you can conditionally throw up an InputBox and collect the value returned:
dim date_: date_ = Now()
if isdebug and username = "me" then
dim value: value = CDate(InputBox("enter the date and time (dd/mm/yyyy hh:mm:ss)", "please", Now()))
' validate the input here
date_ = CDate(value)
end if
And finally, to obfuscate your code you could use the Scripting.Encoder although it looks like this doesn't seem to be supported on Vista or Windows 7. There does seem to be a few hits on googling the phrase obfuscating vbscript, anyway.
Most of this sounds like it can be resolved by the logic of the script.
Have a command line parameter (debug is an appropriate name) and then have some if logic in the code to do as you wish (present the input box).
For the code obfuscation, I don't know how this could be done in vbscript. Windows scripting host works with JavaScript as well though and there are plenty of tools on the web for making JS harder to read. Maybe you want to look a using JS...
HTH,
Matt
I think you can check the property App.LogMode to see if you are in 'debug' mode or not. If it is 0 then you are running debug mode and if it is 1 you are not.