JaydenE55 Posted April 12, 2021 Posted April 12, 2021 (edited) So I have a batch file on my desktop and I need it to run in the foreground. But when starting scripts, Pulseway opens it in the background, But I want it to open in the foreground. So how would I do that? OS: Window 10 Pro 20H2 Edited April 12, 2021 by JaydenE55
Administrators Paul Posted April 12, 2021 Administrators Posted April 12, 2021 Hi Jayden, Refer to this forum post: -Paul KodeTitan 1
eDecisions Posted June 17, 2021 Posted June 17, 2021 Did this a long time ago... This one maps a drive letter to the server for the logged in user, you can work backwards to do anything, basically you have to create a task to make it happen that runs once on demand as the local user:  $Taskname = "netuse" $lastlogon = (New-Object -ComObject WScript.Shell).RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\LastLoggedOnUser") SCHTASKS /CREATE /sc ONCE /st 00:00 /TN $Taskname /RU $lastlogon /TR "c:\maplist.bat" start-sleep -s 1 New-Item c:\maplist.bat -ItemType "file" Set-Content c:\maplist.bat 'net use t: "\\twdserver\Shared\SERVER - Documents" /persistent:yes' schtasks /Run /TN $Taskname start-sleep -s 1 schtasks /delete /tn $Taskname /f  Jamie Taylor 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now