Tag Info

Hot answers tagged

18

As part of our logon script I have that information (and more) logged into a hidden share on a server, with one log file per user. A logoff scripts adds the time the user logged off to the same log file. Easy to set up, no cost and the information is there in an easy to read format.


9

On a non domain machine you can edit the local machine policy to run scripts at startup and shut down (this may not work in Vista Home edition). To access this go to start, run then enter gpedit.msc. In here, expand the user configuration node, then windows settings, then you will find a scripts option where you can set the location of scripts to be run at ...


8

We do this via logon script which updates the computer object's description in AD. You need to perform a custom delegation of control to allow "Authenticated Users" to write the description property of computer objects in the domain/s. Once that's done, all you need is a script that generates whatever information you want and writes the properties to the ...


6

It would be much easier if you used Group Policy Preferences to map the drives and did item-level targeting to filter drive maps by group. This is the preferred way.


5

Logon scripts don't display a command prompt window whilst they are running by default, however it is possible to enable this behaviour via a GPO. The logon scripts will run whilst the explorer shell is loading. You can test the exact timing of this by adding the following to one of your scripts, which will record the time the script is run in a log file. ...


5

You could use something like the following. It reads the registry key for PowerShell. If the read is successful (return code 0), or not, you get the corresponding message box, which you can switch out for other logic you need to do--like install PowerShell if it's not detected. See the source links below for more info. Option Explicit Dim oShell Dim value ...


5

Using a User Logon Script policy will always run the script as the user. There's no getting around that. As an alternative, you could consider using a Computer Startup Script. These are excecuted as the Local System account, which will have privs roughly equivilent to a local administrator account.


5

I perfer using group policy preferences for drive and printer mapping, but it really is just the preference of the person that has to manage it. Both scripts and GPO works fine and can generally give you the same results, but GPO preference I find easier to add criteria and troubleshoot.


5

for /f is your friend. for /f "usebackq tokens=1,2,3 delims=:" %A in (`ipconfig ^| Find "Default Gateway" ^| Findstr/N "." ^| Findstr/B "1:"`) do @if not defined MYVAR set MYVAR=%~C ...might do the trick. Edit: changed the code block to read the third value not the second, and needed to escape the pipes. You could also shorten to: for /f "usebackq ...


5

I might get down voted for this, but so be it. I've always considered logon scripts to be kind of hack'ish and try to only use them as a last resort. There are so many ways to manage systems and users these days with things like Group Policy, Group Policy Preferences, and SCCM/SMS. I mean, there's always going to be cases where there just isn't a better ...


5

You can enable auditing for account logon events. These events (including workstation unlock) will be stored in the DC's security log. There are also third party tools that can make this easier, such as True Last Logon.


4

I just write the user name (as well as other info, like date and time, some program versions and so on) into the computer description using a logon script. That way I can pull all the info from AD Users & Computers quickly and easily, and as a bonus have a good way of identifying which PCs still in AD haven't been used in a while (and are therefore most ...


4

I had to achieve the same result for similar reasons; somehow determine which machine a specific user logged in from. I wanted to know "before the fact", and couldn't change user login scripts as discussed above. I used powershell on the DC that the user was authenticating against to parse the Security event log: get-eventlog "Security" | where {$_.Message ...


4

Use the runas command. or In Windows Explorer you can right-click on the bat file and choose Run As... then enter your credentials. or You could run it from a scheduled task which lets you set credentials.


3

You have two options. One means you'll have to manually pass the password each time (not ideal), the other will let you pass with password from the batch file (but this means anyone can read the batch file and discover the password). You choose which flaw you would rather live with: Option 1 (Manual Password Entry) rem This is the test.bat file runas ...


3

Why do this with batch file gyrations when you can just link GPOs to site objects? The "bonus" being that if you add addt'l subnets or move subnets around you'll never have to edit your script. If you're looking at this being a user logon script that you want to apply only when users logon to specific computers then you'll need to look at using loopback ...


3

ShellExecute the URL.


3

Although we use powershell on our servers, we use vbscript on the clients to login. VBscript is installed by default and we use it instead of CMD batch files because of the access to wmi and specifically we use it to install all the appropriate printers.


3

Windows Vista's Task Scheduler also supports running scripts at those events. http://technet.microsoft.com/en-us/appcompat/aa906020.aspx


3

Here's one of my favorites. We've got 700+ users and various divisions and subgroups that require their own drives. We're mapping based on username currently: if %username% == [username] net use /delete Z:\ if %username% == [username] net use Z: \servername\share another is the mapping of homedrives: net use H: \homeserver\%username% ...


3

It depends on the client OS. I've run into a lot of issues using the native drive and printer map Group Policy functions on XP clients. They just don't seem to work quite right, and the only thing worse than getting a couple "my filez is gone, halp!!!!" tickets every day is getting 300 one morning because that GPO inexplicably decided to not show up for ...


3

There are lots of ways to skin this. For part 2, I have a vbscript that queries group membership and returns an errorlevel that you can use in your batch. The same could be done with powershell. Here is the vbscript: 'On Error Resume Next ' GroupCheck - GjM - returns errorlevel 1 if user is member of group, else returns 0 ' EX: groupcheck.vbs ...


3

Aside from improving logon times, manageability and removing a potential security issue (depending on where the script is stored etc). I can't imagine why you'd ever want to change to group policy and group policy preferences and WMI. I don't know about you but watching that logon script window makes me feel like Matthew Broderick in War Games In all ...


2

Parallel SSH (pssh) is perfectly suited to this task, it executes the same command on multiple hosts in parallel. By default pssh will use 32 parallel threads but this number can be increased if required. Output from the hosts can be logged on the machine that pssh is run from. When logging output pssh will create a text file per host, however your bash ...


2

When it seems like things are difficult in windows, the first question you shold ask yourself is "why is this so hard, maybe there is a different way". In this case while you can map printers in a login script, you probably shouldn't. You can use group policy preferences to apply the primters to the groups you want without scripting. Take a look at: GP ...


2

The session is a true RDP session. The difference is that instead of displaying the remote desktop to the user only the application window is displayed. If you click the details button when launching the RemoteApp you'll see the desktop session being created just as you would logging on to a desktop session. Behind the scenes RemoteApps work exactly as a ...


2

If you are using a startup script, you need to give the Domain Computers group permission in the share and NTFS permissions. Startup scripts run in the context of the SYSTEM account. Your tests that you've run manually will run in the context of whatever the logged on user is. You can test this manually by running psexec -s cmd which will launch an ...


2

No, the policies key is managed by the system. Group policies would not be very useful if a user could change them. You need to manage this with gpmc, and a custom adm template if MS Office builtin gpo template does not have these values. It would appear that Microsoft has a step-by-step procedure for configuring these settings. There may also be a ...


2

Yes it's entirely possible to have multiple logon scripts run in multiple GPO's, but maybe not quite in the way you want. First Option This method works quite well for us, however your needs may be different. Have multiple OU's and Sub-OU's and apply different GPO's with linked logon scripts further down the chain. Take the following OU structure - I have ...



Only top voted, non community-wiki answers of a minimum length are eligible