cancel
Showing results for 
Search instead for 
Did you mean: 
Level 8
Report Inappropriate Content
Message 1 of 5

EEDK Calling a PowerShell Script, which runs ENS Repair Commands - Failing to run Powershell Scipt

Jump to solution

Hello all,

We are using MA 5.6.3 and I wanted to use EEDK to create a custom ePO package do run a Powershell script which performs the followings:

- Checks if ENS installed

- Run ENS Repair commands

- Apply CustomProp5 stating repair success or failure

- Force wake-up

Here are the scripts:

 

1.ENS_REPAIR_START.bat

ECHO ==================================================

ECHO Run ENS_REPAIR_ALL_MODULES.ps1...

:: PushD

pushd "%~dp0"

:: Get software package source directory and set as variable SRCDIR

SET SRCDIR=

for /f "delims=" %%a in ('cd') do @set SRCDIR=%%a

:: Run PowerShell Script...

%comspec% /c %systemroot%\system32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File "%SRCDIR%\ENS_REPAIR_ALL_MODULES.ps1"

:: Always exit with Code 0

Exit /B 0

B. (Portion of) ENS_REPAIR_ALL_MODULES.ps1

See attachment, it looks like community stripped some of the code when uploaded

 

C. Test Results

1. When I run the batch file manually as an administrator

- The batch file successfully calls

ENS_REPAIR_ALL_MODULES.ps1

- Log file generated to C:\Windows\Temp\McAfeeLogs\ENS_Repair\

- MAConfig.exe and CMDAGENT.exe does exactly what it suppose to do.

 

2. But when I create a EEDK package and deploy via ePO

- The batch file doesn't execute the ps1

- Configured logs are not generated

- I watch the files download and they immediately disappear from local setup directory that MA downloads to

C:\ProgramData\McAfee\Agent\Evaluation\ENSFIXER0001\Install

- MAConfig.exe and CMDAGENT.exe does NOT populate Custom Props and does not perform ASCI. 

 

D. Questions are

 

1. Did anyone have similar issue?

2. Is there anything I need to change in the way it calls the ps1 from the batch file?

 

 

Labels (2)
1 Solution

Accepted Solutions
Highlighted
Level 7
Report Inappropriate Content
Message 3 of 5

Re: EEDK Calling a PowerShell Script, which runs ENS Repair Commands - Failing to run Powershell Sci

Jump to solution

Hi Isard,

nice script Thank you.

as Daniel_S wrote the problem here is that Tasks generated with the ePO always run over a 32 bit shell.


I have add a ps script (found here https://serverfault.com/questions/678529/powershell-script-not-working-when-launched-from-ssh-or-win...) that disable the file system redirection, and then works without Problem.

I attached the changed Package. hope this help.

here a link that describe the file system redirection

https://docs.microsoft.com/de-de/windows/win32/winprog64/file-system-redirector?redirectedfrom=MSDN

best
jpd

View solution in original post

4 Replies
Highlighted
Reliable Contributor
Reliable Contributor
Report Inappropriate Content
Message 2 of 5

Re: EEDK Calling a PowerShell Script, which runs ENS Repair Commands - Failing to run Powershell Sci

Jump to solution

Hey mate,

did you test your script with a system shell?

As your script will be running with SYSTEM permissions - I think in a 32bit cmd.exe, you should test your script that way. If that goes well, the script will also work when deployed as ePO package.

psexec will come in handy here:

Psexec.exe /i /s c:\windows\syswow64\cmd.exe

Best regards
Dan
Highlighted
Level 7
Report Inappropriate Content
Message 3 of 5

Re: EEDK Calling a PowerShell Script, which runs ENS Repair Commands - Failing to run Powershell Sci

Jump to solution

Hi Isard,

nice script Thank you.

as Daniel_S wrote the problem here is that Tasks generated with the ePO always run over a 32 bit shell.


I have add a ps script (found here https://serverfault.com/questions/678529/powershell-script-not-working-when-launched-from-ssh-or-win...) that disable the file system redirection, and then works without Problem.

I attached the changed Package. hope this help.

here a link that describe the file system redirection

https://docs.microsoft.com/de-de/windows/win32/winprog64/file-system-redirector?redirectedfrom=MSDN

best
jpd

View solution in original post

Highlighted
Level 8
Report Inappropriate Content
Message 4 of 5

Re: EEDK Calling a PowerShell Script, which runs ENS Repair Commands - Failing to run Powershell Sci

Jump to solution

That did it, thank you for the help on it!

Next thing on this script is going to be to make it more robust on stating what repaired successfully and what did not. 

 

Highlighted
Level 8
Report Inappropriate Content
Message 5 of 5

Re: EEDK Calling a PowerShell Script, which runs ENS Repair Commands - Failing to run Powershell Sci

Jump to solution

Uploading current version with some read-me additions

You Deserve an Award
Don't forget, when your helpful posts earn a kudos or get accepted as a solution you can unlock perks and badges. Those aren't the only badges, either. How many can you collect? Click here to learn more.

Community Help Hub

    New to the forums or need help finding your way around the forums? There's a whole hub of community resources to help you.

  • Find Forum FAQs
  • Learn How to Earn Badges
  • Ask for Help
Go to Community Help

Join the Community

    Thousands of customers use the McAfee Community for peer-to-peer and expert product support. Enjoy these benefits with a free membership:

  • Get helpful solutions from McAfee experts.
  • Stay connected to product conversations that matter to you.
  • Participate in product groups led by McAfee employees.
Join the Community
Join the Community