Page 1 of 1 1
Topic Options
#210542 - 2015-08-18 01:28 AM @userid and startup script / gpo script
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
I've been messing around with using a startup script. Aside from some setup issues I've run into an issue with Kixtart which I want to verify is expected or a bug.

If I run WhoAmI in the startup bat file, and output it to a text file, I get:
nt authority\system

However, if I use kix and output the value of @userid to a text file, I get:
ComputerName$

So my questions are. Is this expected? Shouldn't kix display something along the lines of "System"?

I would like to be able to know if I am running as System. Obviously I could do something like if @userid=@wksta + "$" but that seems kludgy. Is there another way that I am not thinking about?

Top
#210543 - 2015-08-18 03:16 AM Re: @userid and startup script / gpo script [Re: Allen]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
In a domain that is the same thing. I had a chat earlier about this exact thing. It is local system locally but on network the local system translates to the computers system account.

In a startup script you will always run as the system. That's one of the rare things that work in Microsoft related software.
_________________________
!

download KiXnet

Top
#210544 - 2015-08-18 03:21 AM Re: @userid and startup script / gpo script [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
Why would you want to know and what are these setup issues?

The only programs that don't want to install in startup script this far for me have been go2meetmymaker and webex and I was forced to use msi deployment on one of them.

I install vnc, office, service packs, display drivers, network drivers, flash, Java and all sorta things in start up script. Works million times more reliable than the broken gpo msi deployment junk.
_________________________
!

download KiXnet

Top
#210545 - 2015-08-18 03:24 AM Re: @userid and startup script / gpo script [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
Oh and AutoDesk revit and some other AutoDesk program. I eventually showed who da boss though.
_________________________
!

download KiXnet

Top
#210546 - 2015-08-18 03:35 AM Re: @userid and startup script / gpo script [Re: Lonkero]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
The setup issues include:

Not running at startup every time. Wait for Network is enabled, but didnt seem to make a difference. Seems almost like it was random when it would run.

The batch file was running but kix was not. Finally got this sorted, but I am not sure I have it right. The following link, if #1 correct, is probably the reason I was having trouble, as I did not have it configured this way. http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=20568#Post20568

Have yet to access another share with files in them, other than the Sysvol\GPO\Script folder. I read the GPO script needed Read/Execute for Domain Computers and or System. Neither were working when I left.

The reason for wanting to know if the script is running as System is because I was envisioning using the same script for GPO for deployment, and for the traditional logon script.

Something like...
 Code:
if "System"
  ;do system stuff
else
  ;do user stuff
endif







Top
#210547 - 2015-08-18 04:04 AM Re: @userid and startup script / gpo script [Re: Allen]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
if ingroup(domain computers)???

what comes to batch files, never used them in like 10 years.
\\domain\netlogon\wkix32.exe \\domain\netlogon\scriptname.kix

that's what I have for startup and logon script.
which reminds me, I really should change the startup, it does not work too awesome for laptops out of reach of the network....


ps. microsoft sucks.
lenovo laptops suck as well.
_________________________
!

download KiXnet

Top
#210550 - 2015-08-18 06:16 AM Re: @userid and startup script / gpo script [Re: Lonkero]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
Tomorrow I'll try these out... think I like the System() one better.

 Code:
if @userid=System()

endif
 
function System
  $System=@wksta + "$"
endfunction
 
 

function IsSystem()
  if @userid=@wksta + "$"
    $IsSystem=1
  endif
endfunction


Do you have any insight on the perms for other shares?

Top
#210554 - 2015-08-19 01:36 AM Re: @userid and startup script / gpo script [Re: Allen]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
Other perms? Perms are so 80's we don't mention them no more.
_________________________
!

download KiXnet

Top
#210604 - 2015-08-25 11:28 PM Re: @userid and startup script / gpo script [Re: Lonkero]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
Okay, so its either a bug, or MS changed the way it functions somewhere between Windows 7 and Window 10.

Using Kix 4.66,
@userid=
on Windows 7=System
on Windows 10=Computername$

Haven't had time to fully investigate.

Top
#210674 - 2015-09-02 06:07 AM Re: @userid and startup script / gpo script [Re: Allen]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
To Update this thread... still not sure if this is a bug in kix or not. Running whoami always returns System. Sent an email to Ruud, awaiting his response.

Using Kix 4.66,
@userid =
on Windows 7 =System
on Windows 8.1=Computername$
on Windows 10 =Computername$

To address these inconsistencies...

 Code:
function System()
  if @userid="System"
    $System=@userid
  else
    $System=@wksta + "$"
  endif
endfunction

Top
#210675 - 2015-09-02 08:30 AM Re: @userid and startup script / gpo script [Re: Allen]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
Your function is equal to
 Code:
Function system()
$system=@userid
Endfunction
or did I miss something?
_________________________
!

download KiXnet

Top
#210678 - 2015-09-02 03:43 PM Re: @userid and startup script / gpo script [Re: Lonkero]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
Ha, you are absolutely correct...


Hmmm



Edited by Allen (2015-09-02 04:27 PM)

Top
#210679 - 2015-09-02 04:38 PM Re: @userid and startup script / gpo script [Re: Allen]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
Haven't used this yet, but maybe this one will make more sense.

 Code:
Function IsSystem()
  if @userid=@wksta + "$" or @userid="System"
    $IsSystem=1
  endif
endfunction

Top
#210681 - 2015-09-02 08:23 PM Re: @userid and startup script / gpo script [Re: Allen]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
Once I get back to work I have to test this again. I could have sworn windows 7 returns computername$ as well.

Are all these test systems part of a domain?
_________________________
!

download KiXnet

Top
#210683 - 2015-09-02 09:48 PM Re: @userid and startup script / gpo script [Re: Lonkero]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
All tested pcs are part of domain.
Top
#210711 - 2015-09-07 12:36 AM Re: @userid and startup script / gpo script [Re: Allen]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
By complete random chance, I was searching for something else and found the following info from the Windows 8 thread posted 3 years ago...


http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=206364#Post206364
 Quote:
I noticed the @userid macro returns the computername followed by a $ when run as the system from a GPO. Prior versions of windows running scripts the same way return SYSTEM from @userid.

Top
Page 1 of 1 1


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1188 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.071 seconds in which 0.027 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org