If your script invokes some GUI on windows and Jenkins is installed as window service, it would not have access to desktop tools.
Open windows service manager
- Windows+R -> services.msc
Look for Jenkins services
- Right click on service, open properties
Open “Log on” tab.
Check “Allow service to interact with desktop.”
Now when your script will invoke, GUI, it should go fine.