Running batch and powershell scripts as administrator

WINDOWS – RUN BATCH AND PS AS ADMINISTRATORS. This works for Windows 7 and newer. I tested on Windows 7 and 10 64bit and 32bit. #RUNNING CMD/BAT files as administrator, place this at the top of script after @echo off net sess>NUL 2>&1||(powershell saps ‘%0’-Verb RunAs&exit) #RUNNING PS1 FILES as administrator, place this at the ...

creating batch file to kick off powershell script in different versions of windows with different commands

I needed the ability to have a powershell script execute specific ways for specific versions of windows, so after some googling, I hodge podged this. Essentially you will run this script first, as a cmd, or batch file: @echo off setlocal for /f "tokens=4-5 delims=. " %%i in ('ver') do set VERSION=%%i.%%j REM Windows 10 ...

Disabling UAC in Windows 10 but keeping built in apps working like metro apps and edge

If you need to disable UAC, but want to keep the ability to use built in metro apps, like Edge, you can run this: cmd /c REG ADD “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System” /v ConsentPromptBehaviorAdmin /t REG_DWORD /d 00000000 /f cmd /c REG ADD “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System” /v PromptOnSecureDesktop /t REG_DWORD /d 00000000 /f If you want some specifics on what ...

Create batch file to run with elevated permissions to activate windows 10

I had a task of automating Windows 10 upgrades from Windows 7, and one key thing I needed to do was allow for UAC to exist, AND be able to run batch scripts, or powershell scripts as Administrator. Also known as elevated permissions. I created a bat file with these contents: set mydir=%~dp0 Powershell -Command ...

Windows 10 – issues with installed programs not showing up in search

For whatever reason, windows 10 search stopped searching my all apps. I found out re initializing cortona fixes it, which you can do by running an elevated powershell and pasting this into it: Get-AppXPackage -AllUsers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register “$($_.InstallLocation)\AppXManifest.xml”} Once I did that, everything popped up, no reboot was required.

IE9, and IE10 popups to upgrade to IE11 on Windows

We had users complaining about needing to upgrade to IE11, they were running IE8,9, and 10. I tracked down the KB that was installed on patch tuesday to: KB3124275. We have users who have to use Internet Explorer 10 for specific applications, so we cannot ugprade. I removed it from SUS and users PC’s, hopefully ...

Adding HP Printer gets error 0x0000007e

If a Windows 7 machine cannot add a printer because of a 0x0000007e error: Delete BIDI registry key (on server) from HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers\\CopyFiles\BIDI Sometimes the print spooler needs to be restarted.

Running a powershell command via batch or command that is restricted

I had to run a powershell module that I found remotely to remove some pinned applications in Windows 7. I also wanted it to run remotely, and not have to log on to each PC to do so. To kick off a powershell script, I had to add this to a command file: REM KICK ...

Poor mans file audit on Windows Server 2008 R2 – with an easy search function and GUI

I needed a way to audit file deletions on our Windows 2008 R2 Server, but didn’t need to make pretty reports for our C levels, it was just for techs to track down who deleted what. So I used the built in Windows File Audit with GPO. We also have about 1800 people who use ...

Windows 10 not searching desktop applications with cortona

Out of the blue, my start -> search stopped functioning, it would just be blank. I reinstalled Cortana using the following procedure: Open an elevated Command Prompt window (press win + X, and then press A) Type start powershell and press enter Run the command (in one line): Get-AppXPackage -Name Microsoft.Windows.Cortana | Foreach {Add-AppxPackage -DisableDevelopmentMode ...