I am trying to run my Access DB on low priority mode automaticly as soon as it starts up... (Access 2016)
a batch file with this command does not work
start /low c:*accdb paht*
Any help is welcome thanks!
I have found a way via Powershell
*Access db path*
Get-WmiObject Win32_process -filter 'name = "MSACCESS.EXE"' | foreach-object {$_.SetPriority(16384)}
Hope this helps someone :D
Related
I have recently been messing around with powershell scripting to simplify my job and have had great success so far, albeit after some struggle. I have created a few scripts to open ADUC, Comp management, and a few other things in an elevated state but I have been having issues with the below script.
Base code:
$Workstation = Read-Host "Workstation\IP Address"
$Username = Read-Host "Username"
$AdminGroup = [ADSI]"WinNT://$Workstation/Administrators,group"
$User = [ADSI]"WinNT://USA/$Username,user"
$AdminGroup.Add($User.Path)
pause
If I right-click and run it as an admin it works, but as soon as I try to add anything to force it to run in an elevated state it seems like it processes, but then when I check the admin group it does not appear to have worked. I could be totally off base here with my code, so any help is appreciated, I am very new to this. I have been scouring google and other forums but haven't found anything that works. Other code I have attempted:
runas /netonly /user:USA\adm$env:USERNAME "$AdminGroup.Add($User.Path)"
The above code would be the preferred method as it would allow the user to elevate it using their admin account that auto populates so they only need to enter the password. When I do this it prompts for the password and has the correct username, the code processes and I get no errors but does not add the user to the admin group.
I have tried this as well, but no success here either.
$arg = "$AdminGroup.Add($User.Path)"
start-process powershell -Verb runas $arg
pause
I have attempted a few other things as well the past few days, but I feel like I am just running in circles at this point. The best I have gotten it is to create a shortcut to the script and set it to run as admin. However, I would like to be able to remove the portion of typing in the username into UAC and just have it request the password in the powershell window when prompted. I did attempt a search on here as well, but haven't had any success. Maybe it's the context I am using while searching for solutions? Any help/advice for a newbie is greatly appreciated!
I created a script that compacts .mdb files on a schedule.
It works great when I call msaccess.exe with the /compact argument, except when it finds an mdb file that has been corrupted.
Instead of compacting it, it stops processing and shows this message until I click OK, and only after that does it start the compacting: microsoft access has detected that this database is in an inconsistent state
How do I avoid this window? Is there a /quiet or /nogui equivalent argument that shows no GUI and just does the compact commmand?
This script would run at night and I can't be there to click OK every time.
JETCOMPACT is not an option, because it freezes when I try to compact one of our mdb files.
There isn't an easy way in terms of a /quiet command switch but various options are described here:
https://answers.microsoft.com/en-us/msoffice/forum/all/is-there-a-way-to-do-a-quiet-command-line-ms/fe22a76e-3e45-4716-884c-1641ef75d3cf
I solved it myself in PowerShell. This compacts and repairs mdb files without confirmation or messageboxes interrupting:
$ObjectAccess = New-Object -ComObject "Access.Application"
$ObjectAccess.CompactRepair($MDBFilePathSource, $MDBFilePathDestination)
$ObjectAccess.Quit()
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($ObjectAccess)
I need a script that will start Google Chrome and then send a signal for it to go into full screen mode (usually done by hitting f11).
Chrome is installed to the default location.
An example of what I have tried is:
Start-Process -FilePath "C:\Program Files(x86)\Google\Chrome\Application\chrome"
This simple string is not even working for me.
Sometimes a temporary folder is needed to get Chrome to start this way, so in those cases this might work.
$pathToChrome = 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'
$tempFolder = '--user-data-dir=c:\temp' # pick a temp folder for user data
$startmode = '--start-fullscreen' # '--kiosk' is another option
$startPage = 'https://stackoverflow.com'
Start-Process -FilePath $pathToChrome -ArgumentList $tempFolder, $startmode, $startPage
These types of questions are frowned upon due to you not stating what you have tried and you are just asking for a solution.
However since this is simple I couldn't resist.
Start-Process {Your full path to chrome.exe}\chrome.exe -ArgumentList '--start-maximized'
I am working on a project that uses ace editor.
I want to take the user's inputted python code and run the code and show the user the output. I know that this can be done for javascript but can it be done for python.
Any help would be apreciated.
To do that you have to get server side script support(PHP,ASP,JSP.. )
I can give you example from PHP, You have to send ace editor input to server and get executed output back to the output window, this question is broad, I gave you server side part !
<?php
$myfile = fopen("main.py", "w") or die("Unable to open file!");
$txt = "#print (\"Hello World!\")";
fwrite($myfile, $txt);
fclose($myfile);
$output = `python main.py`;
echo "<pre>$output</pre>";
?>
Further reading DOC
N.B :pyhton should be installed on your server and you should have permissions
The backtick operator is disabled when safe mode is enabled or shell_exec() is disabled.
hope this will be helpful !
I think someone here can help me out of the trouble I'm facing.
I got my sites DDOSed and all the html files in my site were added 7 lines of codes at the end of the files. I downloaded all the contaminated files and would like to remove all those bad codes. But the task was overwhelmed. There are 400+ htmls.
So I would ask those gurus, is there any method that I can bulk delete the last 7 lines? I tried notepad++ and other apps but failed to find a better way.
PS. the HTMLS spread in different directory.
Lots of people seem to be using PowerShell for tasks like this these days.
Test this before you run it, but I think this is what you're looking for:
gci c:/USE_REAL_FOLDER_NAME_HERE/ | % {
$path = $_
$file = gc $_
$file[0..($file.length-7)] | % {$_.trimstart()} | out-file $path
}