none
Powershell Access Level Display RRS feed

  • Question

  • Ok, today i was thinking if it is possible to make a powershell script that finds the current logged on user and then import a CSV to find a column called "Level" and if say the value was "1" then the powershell script would open IE in very small in the corner saying

    Username: Bob

    Access Level 1

     

    and then if the value is 2 it would sa

     

    Username: Bob

    Access Level 2

     

    Any Ideas?

    Tuesday, October 11, 2011 3:08 PM

Answers

  • The first half of your request can be achieve as follow:

    I have created a file called BOOKS1.CSV and saved on the root of G drive. This is the content of the file

    username,access_level
    administrator,1
    wilson,2

    The code below will try to find a match between the logged in user account (using the system variable USERNAME) and the CSV file

    $logged = Import-Csv G:\Book1.csv | ? { $_.username -eq $env:username } ; write-host "Username.....: " $logged.username "`nAccess Level.: " $logged.access_level
    

    As I am logged in with a user called wilson, the output will be:

    Username.....:  wilson
    Access Level.:  2

     

    You just need to find out how to import this output to IE...

     

     

     

     


    Thanks, Wilson Souza - MSFT This posting is provided "AS IS" with no warranties, and confers no rights
    Tuesday, October 18, 2011 6:34 AM
    Moderator

All replies

  • The first half of your request can be achieve as follow:

    I have created a file called BOOKS1.CSV and saved on the root of G drive. This is the content of the file

    username,access_level
    administrator,1
    wilson,2

    The code below will try to find a match between the logged in user account (using the system variable USERNAME) and the CSV file

    $logged = Import-Csv G:\Book1.csv | ? { $_.username -eq $env:username } ; write-host "Username.....: " $logged.username "`nAccess Level.: " $logged.access_level
    

    As I am logged in with a user called wilson, the output will be:

    Username.....:  wilson
    Access Level.:  2

     

    You just need to find out how to import this output to IE...

     

     

     

     


    Thanks, Wilson Souza - MSFT This posting is provided "AS IS" with no warranties, and confers no rights
    Tuesday, October 18, 2011 6:34 AM
    Moderator
  • Yeh thanks, i could just make a logon script to run the htm file the powershell created it in VBS or something
    Friday, October 21, 2011 7:29 PM