Trying to execute a powershell script via K1000.  Trying to run a script (built by someone else) that disables SMBv1 (because of recent issues in the wild).

Works perfectly fine on Windows 7 machines (because it is a simple registry change) but on windows 8+ it will not work.  I've tried various fixes already listed in these forums and such to no avail.  Our kbox version is 6.4.x as is the agent.

The current kscript is set to run a batch file with the following:
powershell.exe powershell.exe -nonInteractive -ExecutionPolicy Bypass -File disablesmbv1.ps1 -verb RunAs

I've tried with only one specified powershell.exe and without the -verb RunAs.  I've also run this as local system or as an admin account. I've also run this via "launch program" calling powershell and arguments being the -noninteractive... All come to the same results.

Disablesmbv1.ps1 script can be read and obtained here: https://github.com/TechWhispererCA/disable-smb1-powershell/blob/master/DisableSMB1.ps1

The script works file locally run on machine but when attempting to run via kbox (online kscript) it spits out the following error: The term 'Get-SmbServerConfiguration' is not recognized as the name of a cmdlet, function, script file...
Answer Summary:
Cancel
2 Comments   [ + ] Show Comments

Comments

  • I am having a similar issue with a script I wrote to remove SMB1, I think it has something to do with permissions or elevation. what OS are you getting the Get-SmbServerConfiguration error?
  • Getting it consistently on Windows 10
Please log in to comment

Answer Chosen by the Author

0
Probably cause by a 32 bit process trying to call a 64 bit one, use this for your 64 bit machines 
:D
%SystemRoot%\sysnative\WindowsPowerShell\v1.0\powershell.exe
Answered 05/15/2017 by: HISDTechGuy
Senior Yellow Belt

  • BOOM! That was it... Thanks a million!
Please log in to comment

Answers

Answer this question or Comment on this question for clarity
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja

Share