scheduled task - vbscript policy (437 Views)
Reply
Frequent Advisor
Posts: 45
Registered: ‎09-09-2009
Message 1 of 6 (437 Views)

scheduled task - vbscript policy

Hi

 

I want to run some powershell scripts to check some stuff. Those powershell scripts I want to trigger from a scheduled task vbscript policy. The vbscript looks like this.

 

Dim objShell

Set objShell = WScript.CreateObject("WScript.Shell")

objShell.Run("Powershell -NoProfile -ExecutionPolicy Bypass -File ""C:\ProgramData\HP\HP BTO Software\bin\instrumentation\HP_MailboxMounted.ps1"""), , True

 

If I have understood correctly. WScript object is not available when running vbscript from hp agent. How can I make this work?

 

Thanks

Roar

HP Expert
Posts: 302
Registered: ‎06-01-2012
Message 2 of 6 (422 Views)

Re: scheduled task - vbscript policy

Hello,

 

There is an Enhancement Request to support Powershell in OMW as follow:

 

 

http://support.openview.hp.com/selfsolve/document/LID/QCCR1A100049

 

The suggested workaround its to:

 

" Wrapping Powershell commands inside of VBScript Shell commands."

 

 

Hope this information helps.

 

Thanks and Regards,

Carlos Pinto

 

HP Support

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution

If you liked it I would appreciate KUDOs

Frequent Advisor
Posts: 45
Registered: ‎09-09-2009
Message 3 of 6 (418 Views)

Re: scheduled task - vbscript policy

I guess wrapping the powershell into vbscript is what I am attempting to do, but without success. :(

 

Does there exist some documentation on how to write vbscript to use in hp OM policies?

HP Expert
Posts: 302
Registered: ‎06-01-2012
Message 4 of 6 (411 Views)

Re: scheduled task - vbscript policy

Hello,

 

For OMW the reference guide it's the Online Help .

 

Other way is to look at the bundled policies and see how  they are implemented.

 

Also there are some topics which may help for example:

 

http://h30499.www3.hp.com/t5/Systems-Management-OpenView-OP/OMW-8-16-calling-powershell-script-from-...

 

http://h30499.www3.hp.com/t5/Systems-Management-OpenView-OP/powershell-script-in-scheduled-task-poli...

 

http://h30499.www3.hp.com/t5/Systems-Management-OpenView-OP/OVOW-support-of-Powershell/td-p/4607361#...

 

 

 

Hope this information helps.

 

Thanks and Regards,

Carlos Pinto

 

HP Support

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution

If you liked it I would appreciate KUDOs

Honored Contributor
Posts: 666
Registered: ‎04-21-2011
Message 5 of 6 (394 Views)

Re: scheduled task - vbscript policy

[ Edited ]

 

Change Wscript.CreateObject to Policy.CreateObject

 

Dim objShell

Set objShell = Policy.CreateObject("WScript.Shell")

objShell.Run("Powershell -NoProfile -ExecutionPolicy Bypass -File ""C:\ProgramData\HP\HP BTO Software\bin\instrumentation\HP_MailboxMounted.ps1"""), , True

 

Hope this helps you ..

- Vidyasagar Machani -

Tell me and I forget. Teach me and I remember. Involve me and I learn. -- Benjamin Franklin
Honored Contributor
Posts: 666
Registered: ‎04-21-2011
Message 6 of 6 (391 Views)

Re: scheduled task - vbscript policy

Below are few references :

 

http://h30499.www3.hp.com/t5/Systems-Management-OpenView-OP/VBScript-in-a-custom-scheduled-task/m-p/...

 

http://h30499.www3.hp.com/t5/Systems-Management-OpenView-OP/WScript-objects-available-in-scheduled-t...

- Vidyasagar Machani -

Tell me and I forget. Teach me and I remember. Involve me and I learn. -- Benjamin Franklin
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.