Jump to content

MGH

Members
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

1 Neutral

My Information

  • Location
    Charlotte, NC
  • Agent Count
    1000 - 1500 Agents
  1. MGH

    Run Process as Logged in User

    So here's how I'm doing this .... Seems to work for me.... Thought I would share.... (yea, code could be prettier)... 1) Test if a user is logged on or not. If they are, go for it ... if not, exit the script. So the next steps are what happens if someone is logged on.... 2) Console Shell, echo %username%>c:\windows\temp\Logged_on_user.txt 3) Execute Script, Powershell, Script to Execute is as follows: $text = Get-Content c:\windows\temp\Logged_on_user.txt -Raw $separator = "\" $parts = $text.split($separator) if ([string]::IsNullOrWhitespace($parts[1])) {$consoleUser = $parts[0]} Else {$consoleUser = $parts[1]} $consoleUser = $consoleUser -replace "`t|`n|`r","" $consoleUser = $consoleUser -replace " ;|; ",";" You are left with $consoleUser containing the name of the user logged onto the console. From there you can add what ever you like to the script that needed the user name. Hope this help you and others down the line ....
  2. What methods have you folks found that works RELIABILITY, for running powershell scripts from Automate? Do you use Execute Script? Or do you perhaps prefer writing the powershell commands to a PS1 file and activating it some how? The methods I've tried seem to work at times and others, it doesn't. Just wondering what you folks are doing to run Powershell scripts from Automate that seems bullet proof to you. I struggle with finding a method of running scripts reliability from Automate.
  3. MGH

    LTServer Write to File

    I'm running a script on multiple systems to capture data about them. Specifically members of the local administrators group and send it to file. In a powershell script I am capturing data to a comma delimited variable. When I write the variable contents to a file on the PC, its perfect. If I used LTServer Write to File to put the data on my automate server, the file is written with an 80 character limit. Basically the output is returned over 3 lines instead of a single line. Primary question: Any ideas how to get LTServer Write to file to put everything on one line? Additional question: There seems to be a blank line at the end of the data when using LTServer Write to File... any idea how to remove that? (I can do it, just wondering if it can be done when using the function.) Thanks for the help!
×