Jump to content

KiXtart Login Assistance


Recommended Posts

All hail Kix!!! Glad to see it's alive and well here @MSFN. First I'd like to add a few things to the topic.

If you don't, or can't, manage to switch to synchronous login script processing through GPO, you can always set the reg key on each machine, but it requires a reboot to start using it.

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
"RunLogonScriptSync"=dword:00000001

And you can pop up a dialog prior to login with this one:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
"LegalNoticeCaption"="WARNING: Use of this System is Restricted and Monitored!"
"LegalNoticeText"="Access to this computer system, any of its data, or network resources is limited to those authorized by ..."

Kix can also add a CRLF to make the text more legible if your legal eagles get windy. :P

We also add the Help Desk number to the login dialog with this:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
"LogonPrompt"="Please call the Help Desk at 800-555-1212 if you need assistance."

I was wondering how I could bypass the 00 that shows up after each migration? I want to see an error message if any exists, but if any does not, I want to not see the 0.

That's a simple fix well documented on the Kix forums. All you need to do is assign your statement to a variable to eliminate the echo to STDOUT like so:

; Set IE home page
$ = WriteValue($IEmain,"Start Page",$IEhome,"REG_SZ")

Now, for the slightly OT comments. Kix, while not having a built in engine on Windows as VBScript does, is by far much more flexible. Not only is it much easier to read, its syntax conforms more closely to other languages like Perl and C so it's an easy jump to learn other languages. Also, the support available is much more robust than VBScript. With the addition of COM, WMI, etc there is little you cannot do with Kix while VBS has it's limits. So if you don't want to do much on your login scripts, then VBS and CMD's are great.

As for editors, let me just say that Kixstarter is tweaked for Kix and Allan is very responsive to feedback, but I also love UltraEdit Studio now that I can directly connect to my subversion repository.

Link to comment
Share on other sites


Once you get past a certain number of days it'll start counting backwards.

Actually, it resets after 25 days. So your math will most likely result in a negative numer, not that @TICKS is counting backwards.

If you're using Kix on a box w/WMI, there is a User Defined Function (UDF) for pulling the system uptime. The Uptime UDF will allow you to keep from relying on a 3rd party util, if that's a concern for you.

Link to comment
Share on other sites

All hail Kix!!! Glad to see it's alive and well here @MSFN. First I'd like to add a few things to the topic.

If you don't, or can't, manage to switch to synchronous login script processing through GPO, you can always set the reg key on each machine, but it requires a reboot to start using it.

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
"RunLogonScriptSync"=dword:00000001

Thanks for posting that. I found it the other day when it was brought up, but I didn't bother posting it because most people here have access to their GPO's. I don't... :(

If you need it...here's some quick code to add it to your script:

If InGroup("@WKSTA\Administrators")
$X = WriteValue("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","RunLogonScriptSync","1",REG_DWORD)
EndIf

I was wondering how I could bypass the 00 that shows up after each migration? I want to see an error message if any exists, but if any does not, I want to not see the 0.

That's a simple fix well documented on the Kix forums. All you need to do is assign your statement to a variable to eliminate the echo to STDOUT like so:

; Set IE home page
$ = WriteValue($IEmain,"Start Page",$IEhome,"REG_SZ")

I've always heard it was Bad WooJoo to use just a $ for a variable. I prefer to use $X just in case. :)

As for editors, let me just say that Kixstarter is tweaked for Kix and Allan is very responsive to feedback, but I also love UltraEdit Studio now that I can directly connect to my subversion repository.

Not a bad editor for free. It reminds me a lot of the old KiXscripts Editor. My preference is AdminScriptEditor (which is the new updated version of KiXscripts Editor with support for more languages). PrimalScript is also decent, but costs more. I prefer the way ASE color codes KiX to the way PrimalScript does it.

Link to comment
Share on other sites

Once you get past a certain number of days it'll start counting backwards.

Actually, it resets after 25 days. So your math will most likely result in a negative numer, not that @TICKS is counting backwards.

I can't verify what the actual number was after 25 days because our SMS guys did an "inadvertant" push the other day that rebooted all my servers. Yeah...don't get me started... :D

If you're using Kix on a box w/WMI, there is a User Defined Function (UDF) for pulling the system uptime. The Uptime UDF will allow you to keep from relying on a 3rd party util, if that's a concern for you.

I keep forgetting to check for UDFs...hehe. Using a command line util isn't much of a concern...what I'm working on now is a daily output script that will email relavent information about my servers to me each night. I always do prefer doing WMI calls where I can though because they're much faster. Thanks for the linkage.

Edited by nmX.Memnoch
Link to comment
Share on other sites

I've never come across an error using just the $, but it is sloppy code. :blushing:

As a possible mod to nmX.Memnoch's code, you can also run it from your own system against selected systems in an IP range, domain, etc by throwing it into a loop. Which is probably what you want rather than put another item in your login script that may only hit a subset of your systems.

I know if I put a 3rd party util in our NETLOGON share the admins won't pay attention to why it's there and delete it. gotta love the lines of communication!

Edited by Mordac85
Link to comment
Share on other sites

IIRC, I tried @LDRIVE ( or was it @LSERVER ) but it was giving me problems. Permission problems I think. I ran it under the KixTart debugger and noticed that the return codes for WriteProfileString() was giving an access denied error. What I have written was the only way that I could get it to consistently work. Go figure...

As for @TICKS, most, if not all, of our computers get turned off every night.

-John

Link to comment
Share on other sites

As a possible mod to nmX.Memnoch's code, you can also run it from your own system against selected systems in an IP range, domain, etc by throwing it into a loop. Which is probably what you want rather than put another item in your login script that may only hit a subset of your systems.

I got bored...

Modified from this example script (after fixing part of it).

Dim $Filter[0]
$Filter[0]="Computers"; Or replace "Computers" with "User" or "Group"

$ou = GetObject("LDAP://CN=users,DC=domainname,DC=com")
$ou.Filter = $Filter[0]

For Each $UserOrGroupOrComputer in $ou
$WK = "\\" + Trim(SubStr($UserOrGroupOrComputer.Name,4))
? "$WK"
If Exist("$WK\C$\")
" ONLINE"
$X = WriteValue("$WK\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","RunLogonScriptSync","1",REG_DWORD)
Select
Case @ERROR = 0
" UPDATED"
Case @ERROR > 0
" FAILED WITH @ERROR ERROR CODE"
EndSelect
EndIf
Next

Hmm...thought the CODE tags were supposed to keep things from wrapping?? Anyway, $X = WriteValue through REG_DWORD) should all be on one line.

This will provide the following type of console output for each computer:

\\computername   ONLINE   UPDATED

If the computer isn't online it'll just return the computer name.

Also, in case you don't read the notes on the original script I linked...

CN= should only be used on default AD containers. If you've made a seperate OU for your computers then you should use OU=. For example, if your domain name is domain.com and you're using the default Computers container then use:

CN=Computers,DC=domain,DC=com

But if you've made a new OU called Workstations (because some people like to keep their workstations, laptops, servers, etc, seperate) then you would use:

OU=Workstations,DC=domain,DC=com

Edited by nmX.Memnoch
Link to comment
Share on other sites

I got bored...

Geez, wish I had the time for that. I spent too much time on the board yesterday and am paying for it now. Nice loop tho and you can substitute, or add, any other action to run that against an entire OU. Sweet!

Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...