I need a script that will find the computer a user last logged into.

I am still learning scripting, I need a script that will allow me to pull in usernames from a csv file. Find what computer they last logged into and output that to an csv file.
I have looked all over and can't find exactly what I need.
 I found the following script but I need  to add the resuitsize unlimited but can not figure out where to put it we have a large environment. Also I need to be able to grab username from a csv file. Any assistance you can provide is appreciated.
##  Find out what computers a user is logged into on your domain by running the script
##  and entering in the requested logon id for the user.
##  This script requires the free Quest ActiveRoles Management Shell for Active Directory
##  snapin  http://www.quest.com/powershell/activeroles-server.aspx
Add-PSSnapin Quest.ActiveRoles.ADManagement -ErrorAction SilentlyContinue
$ErrorActionPreference = "SilentlyContinue"
# Retrieve Username to search for, error checks to make sure the username
# is not blank and that it exists in Active Directory
Function Get-Username {
$Global:Username = Read-Host "Enter username you want to search for"
if ($Username -eq $null){
Write-Host "Username cannot be blank, please re-enter username!!!!!"
Get-Username}
$UserCheck = Get-QADUser -SamAccountName $Username
if ($UserCheck -eq $null){
Write-Host "Invalid username, please verify this is the logon id for the account"
Get-Username}
get-username resultsize unlimited
$computers = Get-QADComputer | where {$_.accountisdisabled -eq $false}
foreach ($comp in $computers)
$Computer = $comp.Name
$ping = new-object System.Net.NetworkInformation.Ping
  $Reply = $null
  $Reply = $ping.send($Computer)
  if($Reply.status -like 'Success'){
#Get explorer.exe processes
$proc = gwmi win32_process -computer $Computer -Filter "Name = 'explorer.exe'"
#Search collection of processes for username
ForEach ($p in $proc) {
$temp = ($p.GetOwner()).User
if ($temp -eq $Username){
write-host "$Username is logged on $Computer"

If you are querying by user "resultset size" will be of no use.
You also have functions that are never used and the body code doe snot look for users.
Here is what you scrip looks like if printed well.  It is just a jumble of pasted together and unrelated items.
## Find out what computers a user is logged into on your domain by running the script
## and entering in the requested logon id for the user.
## This script requires the free Quest ActiveRoles Management Shell for Active Directory
## snapin http://www.quest.com/powershell/activeroles-server.aspx
Add-PSSnapin Quest.ActiveRoles.ADManagement -ErrorAction SilentlyContinue
$ErrorActionPreference = "SilentlyContinue"
# Retrieve Username to search for, error checks to make sure the username
# is not blank and that it exists in Active Directory
Function Get-Username {
$Global:Username = Read-Host "Enter username you want to search for"
if ($Username -eq $null) {
Write-Host "Username cannot be blank, please re-enter username!!!!!"
Get-Username
$UserCheck = Get-QADUser -SamAccountName $Username
if ($UserCheck -eq $null) {
Write-Host "Invalid username, please verify this is the logon id for the account"
Get-Username
get-username resultsize unlimited
$computers = Get-QADComputer | where { $_.accountisdisabled -eq $false }
foreach ($comp in $computers) {
$Computer = $comp.Name
$ping = new-object System.Net.NetworkInformation.Ping
$Reply = $null
$Reply = $ping.send($Computer)
if ($Reply.status -like 'Success') {
#Get explorer.exe processes
$proc = gwmi win32_process -computer $Computer -Filter "Name = 'explorer.exe'"
#Search collection of processes for username
ForEach ($p in $proc) {
$temp = ($p.GetOwner()).User
if ($temp -eq $Username) {
write-host "$Username is logged on $Computer"
I suggest finding the original code then use the learning link at the top of this page to help you understand how it works in Powershell.
¯\_(ツ)_/¯

Similar Messages

  • Simple script that will export the coordinates (layer bounds - top left x,y)

    Hi,
    I'm looking for a simple script that will export the coordinates (layer bounds - top left x,y) of the layers to an seperate xml/txt file.

    Your screen capture looks like it's from Photoshop.
    In InDesign sub layers are page items, the containing layer has no dimension. So you could get all the page item's x, y, width, height. But you might have to consider groups and then the layering could be very complex. The stacking order could also get complex. Page items have an index, but it's relative to its parent container.

  • Disabling the integrated graphics card or updating any software they use that will aid the computer in switching between the two graphics chips.

    So I couldn't activate Assassin's Creed 3 on bootcamp which I shuold have been able todo. I posted it on Ubistoft Support and This is what I got!
    Hello ,
    It looks like your DXDiag report is showing only an integrated graphics card. Being an Apple computer with an i7, it should have a dedicated video card as well. You may need to contact Apple support so they can help you either disable the integrated graphics card or update any software they use that will aid the computer in switching between the two graphics chips.
    So I was wondering how I could disable the intergrated grahics card or update any software that will aid the ocmputer in switching between the two graphic chips.

    The Early 2011 13-inch MacBook Pro has only got one graphic card, and this is the integrated card, Intel HD Graphics 3000.
    Some games don't support this type of GPUs, and it looks like Assassin's Creed is one of them, so unfortunately, you can't run the game in this MacBook

  • How to find out if a user is logged into a windows XP or VISTA machine

    Hi,
    Could somebody please tell me how to find out remotely over a LAN, whether a user is logged into a computer that is running windows XP/VISTA or not? How can this be programmatically done if we know the name of the remote machine?
    Thanks.
    Ravisara

    Hi,
    Thanks for all the replies.
    Actually it seems that my question has either been misunderstood or has been badly phrased by me.
    What I want to know precisely is the way to find out if a user is logged into a machine or not. Say for example in a LAN there are three computers called A, B and C. If my Java program is running on machine C, how can the program check whether a user is logged into machine A? Assuming JRE is present in all three machines, the machines have as their OS windows XP or VISTA and all machines are connected to a windows domain(Windows 2003 server based network)
    The idea here is to identify all the computers in a network that users are not logged into and then to remotely shutdown those computers in order to minimize wastage of electricity(preferably after a particular time of the day in an organization).
    Any replies would be much appreciated.
    Kind regards,
    Ravisara

  • Looking for a script that will find broken links

    I create long documents in InDesign, and I often have 50-75 Indesign documents in my InDesign book. Because what I do is production publishing, at any one time I'll have a half dozen similar books under construction. All the books contain the same chapters (as far as file name an basic content). I need a script that I can run on the final PDF for each project to make sure that all of my hyperlinks/cross references are intact. This is to ensure that I didn't accidentally link to a chapter from a different project. In other words, I need to make sure that my final PDF contains both the source and the destination.
    Does anyone know where I can find a script like this?
    Thanks,
    Kelly Vaughn

    A script can't do that. Maybe a plugin.

  • I need a logout script that will erase the standard user account data after logout.

    I have a lab of 35 Macbook Pros and I am trying to make it where when the user logouts, it will erase the data after they logout.
    I have found several articles about deleting user accounts when they login through AD, but this is not the case.
    Any help would be much help!

    Then when they are at those system they do not Login and if they do have to enter a password it is whatever it is for the Base user account that is setup. Right?
    I'd look at the Mac KB system to see if you can restrict saving to the local HDD but yet allow saving to a thumb drive or not.
    To do what you want the system would need to keep track of all files saved from time X to time Y, and those times would be every changing. Not sure you are going to get there from here.
    Not sure what you mean by Lab machines. I've worked in and gone to school at a Graphic art school and they have hundreds of Lab Mac's that each student must log into with there own user account when in different classes and when saving any of there work it gets saved on the server so it can be retrieved by them when they log into another system someplace else throughout the school or when using their own computer and connected to the schools network.
    I wish you the best of luck with this project.

  • I want to build an apple script that will parse the name of a file and sort it into folders.

    This is for medical application, so I will do it as such: CLIN_FAM_PAT_FILE_DATE.EXT sorts into Folders: Family/Patient/Type/Date, either sorting into folders that already exist (and make them shared folders eventually for each patient) or creating new folders with names as indicated by the file name.  The Prefix "CLIN" is an indication that the file is a clincial patient document and so needs to be filed.  Files without that prefix would be ignored. 
    So the file format would be:
    Family Folder
    Family DocumentsDocument Type folders
    Patient folders - for each person who is a member of that houshold unitDocument Type Folders (such as x-rays, lab reports, or insurance info)Within each document type, there would be separate folders based on the date (or at least the order of the docs would be by date)
    For example:   A document called CLIN_JONES123_JAMES228_LAB_022614.PDF which is a lab summary for James Jones done on 2/26/14 would go here
    JONES123 FolderJAMES228 FolderLab Results FolderFebruary 2014 Folder.
    Makes sense?  I am initially putting these files into a Filemaker Pro database and having it compile the files based on patient name, type, date, etc.  But need to use Applescript to create the folders so things are organized in a way that I can easily share with patients.
    Makes sense?

    You can call this script from Applescript (just need to do some escaping of quotes):
    This can be run in Applescript:
    do shell script "
    DestinantionFolder=$HOME/Desktop
    MONTHS=(January February March April May June July August September October November December)
    for f in ~/Desktop/*
    do
         if [[ $( echo \"${f##*/}\" | cut -d_ -f1 ) == \"CLIN\" ]] ; then
              ff=$( echo \"${f##*/}\" | cut -d_ -f2 )
              pd=$( echo \"${f##*/}\" | cut -d_ -f3 )
              date=$( echo \"${f##*/}\" | cut -d_ -f5 )
              date=${date%%.*}
              mo=${date:0:2}
              yr=20${date:4:2}
              Dir=$DestinantionFolder/$ff/$pd/${MONTHS[$mo-1]}\\ $yr/
              if [ ! -d \"$Dir\" ]; then
                   mkdir -p \"$Dir\"
              fi
              mv \"$f\" \"$Dir\"
         fi
    done"
    ...is there a way to trigger this whenever a new file is created to check and see if it needs to be moved
    Yes, with Automator.  When you Open Automator, choose Folder Action
    I copied what you did and while the script ran successfully, I don't see any new folders created.  Your shell script makes sense; I am not sure why it doesn't create folders.
    The script as written only looks for files in the Desktop Folder
    (edit by changing: DestinantionFolder=$HOME/Desktop )
    To test I created a file on my Desktop
      touch ~/Desktop/CLIN_JONES123_JAMES228_LAB_022614.PDF
    and Folders were created and the file moved.
    (Note: I only tested that format.  If the file has any other format, it will fail)

  • Need a script that will put photo on white background

    I am currently using CS3 Photoshop on a MacPro Intel
    I have about 31,000 photos that I need to take the background out of. Most of the photos were not shot against white, black or green screens. These are mostly images of plumbing products. The majority of these images do have clipping paths. I am currently having to manually select the path, make selection, select inverse, cut the selection, save, close. I have tried to create a script to do this, but haven’t been successful in doing so yet. I have been able to create basic scripts in the past without issues, but this one has me stumped. Any help or direction would be greatly appreciated.

    As long as the files do have clipping paths this should get you started. It applies the clipping path as a vector mask. All you should have to add is the save and close part. If you need help with that let me know what format you want to save and the save options.
    // apply clipping path as vector mask
    var clipPathIndex = clippingPathIndex();
    if( clipPathIndex != -1 ){
         activeDocument.layers[ activeDocument.layers.length -1 ].name = 'Converted Background';// rename bottom layer incase isBackground
         activeDocument.pathItems[ clipPathIndex ].select();
         createVectorMask();
         activeDocument.pathItems[ clipPathIndex ].deselect();
         // or
         //activeDocument.pathItems[ clipPathIndex ].remove();
    // Function: clippingPathIndex
    // Description: Gets the index of the activeDocument's clipping path
    // Usage: clippingPathIndex()
    // Input: None
    // Return: Index as Integer. -1 if there is no clipping path
    function clippingPathIndex(){
         var ref = new ActionReference();
              ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
         var desc = executeActionGet( ref );
         var clippingPath =  desc.getObjectValue(charIDToTypeID("Clpg"));
         return  clippingPath.getInteger(charIDToTypeID("ClpI" ));
    // Function:  createVectorMask
    // Description: Make vector mask from active path
    // Usage: createVectorMask();
    // Input: None
    // Return: -1 if failed
    function createVectorMask() {
      try{
        var desc = new ActionDescriptor();
            var ref = new ActionReference();
            ref.putClass( charIDToTypeID('Path') );
        desc.putReference( charIDToTypeID('null'), ref );
            var mask = new ActionReference();
            mask.putEnumerated( charIDToTypeID('Path'), charIDToTypeID('Path'), stringIDToTypeID('vectorMask') );
        desc.putReference( charIDToTypeID('At  '), mask );
            var path = new ActionReference();
            path.putEnumerated( charIDToTypeID('Path'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
        desc.putReference( charIDToTypeID('Usng'), path );
        executeAction( charIDToTypeID('Mk  '), desc, DialogModes.NO );
      }catch(e){ return -1; }

  • Need a program that will save the capacity settings for all storage bins

    Hey all,
    I would really apprecaite any help with a program I am trying to come up with.
    What I need to do is create a program that:
    1. Will save the capacity settings for all storage bins to
    a file
    2. Then update them all to allow unlimited capacity BUT be able to revert back to the
    original that was saved.
    Any suggestions about possible existig reports that I may be able to modify to suit my needs, or where to start from if I have to do this from scratch?

    I know I'm talking about expensive apps, but having been in prepress for about 30 years now, I really don't look at anything other than Quark XPress or InDesign for page layout apps. Your printing vendor will also be much happier with you when you use these products. Some areas of the U.S. tend to be mostly Quark oriented; others, InDesign. Ask your vendor what they would prefer, and if there are any free or cheap alternative apps they'll accept documents from.
    Apple's Pages app (part of iWork) is a decent page layout program, but hasn't been updated in four years. It also doesn't support CMYK. If you place a CMYK image in the app, it will export out an RGB version of it. Not good! You can work with RGB images if you prefer, but your CMYK translations will be left to the skill of the print shop you use to do the conversions.
    Don't even think about using Word. It has what it calls a page layout option, and does pretty much work like one, but there's no good way to import it into a real layout app such as InDesign. You end up paying the printer for their time to rebuild your entire project in either XPress or InDesign so they can actually do something with it.

  • Can't iconvert SD600 files on mac book pro, apparently not compatiable.  What software can i download that will transcode the files so i can log

    I have the SD files on my mac book pro hardrive but they are not compatiable and i cannot view them. I want to edit the clips in FInal Cut Pro.  I think i need to downloadd some software which will transcode the files and then i can import into Final Cut Pro? Any suggestions greatly appreciated!

    Acorrding to the technical specs, it shoots mpeg4/h.264... However, I see other places mention it is MTS...
    Do you still have the original file structure intact? Or do you have just individual movie files? whats the extension? .MTS, .MPEG4, MOV?
    If MTS and you no longer have the original file sturcute intact, you need to use Clipwrap, if you do have the original files structure, you may be able to import using Log and Transfer....

  • Secure Zones: Is there a way to get the date a user last logged in?

    First my goal - I'd like to create an email template saying "We miss you - it's been a while since you visited.", etc.
    Anyone who hasn't signed into their account in a month or so would be added to a list. I know there's nothing built into BC for this, but I was thinking it MIGHT be possible to set a cookie for login date and record that as an anniversary date in the CRM. If they come back to the site that date gets updated. If they don't, then an email would be sent 30 days after the anniversary date.
    Have any of you done anything similar, and if so, how?
    Thanks,
    Jason

    Date stamps in the image are an old method suited to film cameras. These days, digital cameras encode the date into EXIF data embedded in the digital file. If for some reason you need the date stamped on the image, I'm sure you can find an app to do this either on your phone as you take pictures, or an app on your computer that can read the EXIF data and add it to the image.

  • How to get the dates a user has logged into the portal??

    I need to know all the times and the dates a user has loggin to the portal? Do you know any way to do this? I was trying to use "successfullogoncount" from UME_STRING of the PCD database but it doesn't say anything about the dates. I also try to use "lastsuccessfulllogon" from the sama table but, as the name says, it just give me the last date of logon... Please help!!!

    Hi Pablo,
    probably you could work with Portal activity reports.
    This can generate reports on activity in the portal, either reports on how many users were logged on to the portal or reports on the most popular pages and iViews.
    look out on this weblog at
    https://www.sdn.sap.com/sdn/weblogs.sdn?blog=/pub/wlg/1242. [original link is broken] [original link is broken] [original link is broken]
    From this you can know which user has logged on at which date and time.
    If you are not looking for Portal activity reports try this:
    You can  get this information in the Visual Administrator of the J2EE Engine.
    Goto  Security Provider Service -> Runtime -> Login (Sessions).
    This would return a table showing the users along with the logging in start date&time, (if logged out) log out date&time, user-Ids, etc.
    Hope this helps,
    Regards,
    Uma.
    Message was edited by: Uma Thirugnanam

  • Need a powershell script that will modify the path of an existing Outlook 2010 OST file

    For new users we have a GPO in place that creates the OST file in the correct location.  The GPO also works on existing users who create a new Outlook Profile.
    The problem I am trying to solve is modifying an existing Outlook Profile and changing the location that the OST file is written to.
    I have to put the users OST file on the network.  Yes, I do know that this is not supported by Microsoft, but I have zero clients (WYSE units) on non-persistent VMware virtual machines.  This means they cannot keep the OST file on the PC. 
    Our email provider requires us to run in Cached-Mode so OST files are here to stay.
    Forcing 3000 users to create new Outlook profiles would not have a good outcome.
    I also have to relocate their PST files onto the network, which is also not supported.  I have been able to connect PST's with powershell, but disconnecting them has been challenging (can't make it work even once) so if I could get some help with that
    too that would be excellent.
    Thanks

    Hi,
    You may refer to the following article to create the registry keys and deploy it with logon script:
    http://www.slipstick.com/exchange/moving-outlook-ost-file/
    Best regards,
    Rex Zhang
    TechNet Community Support

  • Script that will show the character count of all carriage resturns

    I have found a bug when exporting an indd to idml. If a a carriage return falls in a character count that is a multiple of 8000 + 1 it is converted to a paragraph separator (u2029). I am in the process of mass exporting around 3000 files to idml for a project. I am trying to come up with a way with a script to check the files to see if carriage returns exist in these locations. I am fairly new to scripting and don't know how this would be done. I know it is possible to get character counts but is it possible to check if a character exists in a certain character count from the beginning of a story? Any help on this would be appreciated.
    Also has anyone else ran into this with exporting to idml? I have submitted a bug report. This is can be recreated across multiple computers, OS's and versions of InDesign.

    @Blujely – about your initial question about showing a specific character at an n-th position in a story, you could use a simple GREP search in InDesign and restrict that search to a specific story (e.g. the story of a selected piece of text):
    Search for the n-th position with the formular in dummy-syntax:
    Positive look behind of any character in the exact length n-1 + character
    E.g. if you want to look for a "carriage return", defined in GREP as \n at every 10th position, search for:
    (?<=.{9})\n
    In your case that would be:
    (?<=.{8000})\n
    Uwe

  • Need a Script that will count different codes and enter in another field

    I am using ES2,  I have a form which users enter codes (50 different codes) in a code field.  I need for the corresponding toatl box for each code to increase by 1 for each time the corresponding code is entered.  Have just started using ES2 and any help would be welcome.
    TY

    I am using ES2,  I have a form which users enter codes (50 different codes) in a code field.  I need for the corresponding toatl box for each code to increase by 1 for each time the corresponding code is entered.  Have just started using ES2 and any help would be welcome.
    TY

Maybe you are looking for

  • HP LaserJet CP1525nw drivers

    I'm trying to install the 64 and 32 bit driver for the HP laserjet 1525 printer on a server. I can get to the page where the download is found, I extract the files and put them on the desktop of the server. When I go through the wizard in windows ser

  • Problems after 10.9.2 update on Mac Mini

    So, after I updated, two things happened. 1. safari will no longer open- boots to error saying safari has quit unexpectedly. It will work in safe mode though. 2. it reset my display settings to my tv. i need underscan option slider but it is gone now

  • Motion 3. using the camera

    Im wanting to be able to move the picture at different times and be able to rotate it at different times. for eg. I want a photo to zoom forward, sit there for a few seconds. then i want to rotate it to the left and zoom it back to the side. Im not a

  • MBLB Report functional spec

    Dear Friends, Client Required  MBLB Report his own format that is. Vendor Name : XXXXXXXX        ADDERS:   XXXXXX           City:  XXXXXX Material Name ,      Material description,     Plant,     Batch,    Unrestricted Qty,         In quality inspect

  • Making a Thread Pool

    hi, I need to know if its possible to make a thread pool in java where the size of the threads in pool varies by user input (basically on the work load but is not Dynamic say only like 3 variables 10,15,20 threads ) The threads do not behave in a FIF