diff --git a/core/src/main/java/hudson/model/Computer.java b/core/src/main/java/hudson/model/Computer.java
index 71e7ca1aef..e2abbcd3ec 100644
--- a/core/src/main/java/hudson/model/Computer.java
+++ b/core/src/main/java/hudson/model/Computer.java
@@ -340,6 +340,24 @@ public abstract class Computer extends AbstractModelObject {
w.close();
}
+ public void doScript( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
+ // ability to run arbitrary script is dangerous,
+ // so tie it to the admin access
+ Hudson.getInstance().checkPermission(Hudson.ADMINISTER);
+
+ String text = req.getParameter("script");
+ if(text!=null) {
+ try {
+ req.setAttribute("output",
+ RemotingDiagnostics.executeGroovy(text,getChannel()));
+ } catch (InterruptedException e) {
+ throw new ServletException(e);
+ }
+ }
+
+ req.getView(this,"_script.jelly").forward(req,rsp);
+ }
+
/**
* Gets the current {@link Computer} that the build is running.
* This method only works when called during a build, such as by
diff --git a/core/src/main/resources/hudson/model/Computer/_script.jelly b/core/src/main/resources/hudson/model/Computer/_script.jelly
new file mode 100644
index 0000000000..28affc8bba
--- /dev/null
+++ b/core/src/main/resources/hudson/model/Computer/_script.jelly
@@ -0,0 +1,11 @@
+
+
+
+
println System.getenv("PATH")
+
+ This execution happens in the slave agent JVM.
+
+
+
diff --git a/core/src/main/resources/hudson/model/Computer/sidepanel.jelly b/core/src/main/resources/hudson/model/Computer/sidepanel.jelly
index 0e624e10f5..7cafd493ec 100644
--- a/core/src/main/resources/hudson/model/Computer/sidepanel.jelly
+++ b/core/src/main/resources/hudson/model/Computer/sidepanel.jelly
@@ -7,6 +7,7 @@
+
\ No newline at end of file