Logon/Logoff/Startup/Shutdown Scripts, what do you use?

mvbighead

Diamond Member
Apr 20, 2009
3,793
1
81
I am just curious as to what other are using for scripts on systems in their environment. At present, we use KIX scripts in our environment, and don't have any problems with them. Running command line arguments, etc. all work quite well.

In addition, my boss is hearing a lot about Powershell scripts, so I have been investigating that lately. I seems to be very robust in extracting information from the system using WMI, and various other components. I can certainly see that there is some benefit to extracting system information, but much of the other stuff that I am doing with KIX isn't functioning as expected with Powershell, such as trying to log some information to a CSV file, and with commas in place, it is not pulling up properly when viewed as a CSV with Excel.

Let me know what you use, and if you think PowerShell (or something else) would be a step in the right direction from Kix.
 

mvbighead

Diamond Member
Apr 20, 2009
3,793
1
81
To put it shortly, a lot of stuff.

I do a lot of logging: who has local admin rights, virus dats, who has FireFox (and therefor can bypass the content filter),.
Adding/Deleting shortcuts to user desktops based on Security Groups, etc.
Installing/Uninstalling Applications that are no longer in use.
Modifying registry keys to change application settings, etc.

Those are the things I can think of right off hand.
 

RadiclDreamer

Diamond Member
Aug 8, 2004
8,622
40
91
Originally posted by: mvbighead
To put it shortly, a lot of stuff.

I do a lot of logging: who has local admin rights, virus dats, who has FireFox (and therefor can bypass the content filter),.
Adding/Deleting shortcuts to user desktops based on Security Groups, etc.
Installing/Uninstalling Applications that are no longer in use.
Modifying registry keys to change application settings, etc.

Those are the things I can think of right off hand.

Most of this can be done via GPO and .bat files as startup scripts
 

mvbighead

Diamond Member
Apr 20, 2009
3,793
1
81
This I know, in fact, a lot of our installs are performed with GPO, as well as various other settings. However, adjusting the registry is far too complicated, IMO, with GPO. There is a lot that GPO cannot do, or does not do well, that I handle with scripts. IF/ENDIF clauses, to my knowledge, don't exist anywhere for GPO, so many of the changes made with scripts can be fine tuned to do exactly what is wanted.

Really, to put it simply, I use scripts to do everything that I can't do with GPO, or to do the things that GPO doesn't do well.

As for batch files, KIX can use the command line, thus it can do whatever a batch file can do, but they have a lot of additional functionality that can be cleanly coded to produce almost whatever I want. In the end, I am not looking to get rid of KIX, I am looking to see if there is something better. Given that a KIX script can pass command line arguments, running a batch file as a script isn't a better alternative, IMO.
 

mvbighead

Diamond Member
Apr 20, 2009
3,793
1
81
Originally posted by: snikt
We use VBScript. We use GPOs.

We use GPOs to disseminate our VBscripts.

Clean and simple.

We do disseminate our Kix scripts with GPOs as well, so I could easily transition to something else (such as VB). One question I do have for you is whether you can use Security Groups to control distribution.

For example, a snippet of my code would look like:

If InGroup("Accounting")
Copy "\\server\share\some.url" "%userprofile%\Desktop\SomeFile.url"
EndIf

Can you accomplish this with VB, and if so, how? Thanks in advance if you can provide that information.
 
Mar 26, 2008
148
0
0
We've been using this for quite some time:

Dim f, fso, filespec, Source1, Dest1, UserID

set WshShell = Wscript.createobject("Wscript.shell")
Set WshNetwork = WScript.CreateObject("WScript.Network")
set fso = createobject("scripting.filesystemObject")

UserID = WshNetwork.Username

Source1 = "\\DomainController\NETLOGON\share\OUname\*.*"

Dest1 = "C:\Documents and Settings\"& userid &"\Desktop\"

fso.copyfile source1,dest1, true
 

Jamsan

Senior member
Sep 21, 2003
795
0
76
To get which groups a user is a member of:


Set objSysInfo = CreateObject("ADSystemInfo")
Set objNetwork = CreateObject("Wscript.Network")

strUser = objNetwork.UserName
strUserPath = "LDAP://" & objSysInfo.UserName
Set objUser = GetObject(strUserPath)

For Each strGroup in objUser.MemberOf
strGroupPath = "LDAP://" & strGroup
Set objGroup = GetObject(strGroupPath)
strGroupName = objGroup.CN

Select Case strGroupName
Case "Information Technology"
objNetwork.RemoveNetworkDrive "T:", true, true
objNetwork.MapNetworkDrive "T:", "\\xyz.domain.com\it$", true

Case "Human Resources"
objNetwork.RemoveNetworkDrive "R:", true, true
objNetwork.MapNetworkDrive "R:", "\\xyz.domain.com\hr$", true
End Select
Next
 

mvbighead

Diamond Member
Apr 20, 2009
3,793
1
81
I may have to link into that. I dunno if moving to VB would necessarily provide a perceivable benefit over KIX either, but I'm sure more people have intimate knowledge of VB than those who have heard of kix.

As a side note, it seems I cannot get to this thread any longer through my work's IP. If I connect to our public wireless (which is on an entirely separate network), I can get in no problems. Any advice for this issue?