Hinton
Hinton

Reputation: 91

Can no longer start PowerShell script from batch file

We have a batch file that certain users can launch from their local machines that will run a PowerShell script on a DC in order to unlock user accounts or reset a password. However, all of a sudden it's not working, not even for network admins running it as an administrator. If we log on to the DC and run it locally, it works exactly as it should.

There haven't been any changes to the permissions of the file and no changes to the AD groups that have permission to run the file.

The batch file is this:

@echo off
cls
echo Loading, Please Wait...
;C:\Windows\System32\WindowsPowerShell\v1.0\Powershell.exe -ExecutionPolicy Bypass -File %logonserver%\<PATH TO FILE>\FILENAME.ps1

Same batch file that it's always been, but now when we run it remotely, we get multiple errors:

The term 'Get-ADGroupMember' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Locally, it runs just fine. And yes, the first thing the PowerShell script does is

Import-Module ActiveDirectory -ErrorAction SilentlyContinue

As I said, it used to work but now it doesn't and we're completely lost as to why. We've searched and searched, but can't seem to find any information as to what might be causing it to error out.

If anyone has any ideas or suggestions, we would appreciate it.

Upvotes: 0

Views: 97

Answers (1)

Hinton
Hinton

Reputation: 91

Discovered that RSAT wasn't on any of the machines anymore. It required downloading the installer and running it on the machines. Once we did that, everything works like it should.

Upvotes: 1

Related Questions