Variable for currently signed in user in collection/scan?
Is there a way to refer to the currently logged on user to use for scanning and collections?
For example if the currently logged on user is Tom.Smith, then can I have that as $CurrentLoggedOnUser so I can do a file scan for:
C:\Users\$CurrentLoggedonUser\Documents\File.csv to make sure I can check if File.csv exists for Tom.Smith's user folder path?
I am banking on the currently logged in user to be relevant to whether active users have the file I need. But I don't want to assume the active user has the file just because "File.csv" was found in some other user's profile folder under c:\users.
-
You can achieve this by creating a PowerShell script and deploy it :-)
Script-content:
- Get currently logged on user --> $currentlyLoggedOnUser
- Check if file exists in $currentlyLoggedOnUser ´s profile
- then, do whatever you want (e.g. copy file if it does not exist)Or write a different PowerShell script and create a scan profile in inventory:
- Get currently logged on user --> $currentlyLoggedOnUser
- Check if file exists in $currentlyLoggedOnUser ´s profile
- write the result as $TRUE or $FALSE to registry
- create scanner for registry value
Then you can deploy the script to all clients of your choice and scan that collection with your created scanner. After that you can create a report for that value and do what ever you want :-)
Please sign in to leave a comment.
Comments
1 comment