Code for retrieving powershell command output

Is there any scripting in java to get the output of powershell command.

hello 
please help me out
I want to retrieve security eventlog with powershell command.but when ever run the powershell code I recieve the following error:
Requested registry access is not allowed
so that,I have searched  on the internet Days and nights .which I got from the Internet was change the Event log reader Group and change the
followinfg registry key  and add read permission:
KEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Security
Right click and Add Read permissions for Event Log Readers.
in spite of the above task,i can not do that.
any help would be appreciated

Similar Messages

  • How can we write the code for opening the command prompt and closing the

    how can we write the code in java for opening the command prompt and closing the cmd prompt from eclipse (cmd prompt should close when click on the turminate button in eclipse)

    rakeshsikha wrote:
    how can we write the code for opening the command prompt and closing theBy typing in Eclipse (which you seemingly have)?

  • Why color code css using powershell command is not visible in email ?

    Hello,
    I am applying color code for disabled status in PS script as  written below :
    $ReportData = Get-SPServiceInstance | Select Server,TypeName,Status,NeedsUpgrade | ConvertTo-Html -Fragment
    $DisabledStatus='<td>Disabled</td>'
    $DisabledColorStyle='<td style="background-color:red !important;color:white !important" >Disabled</td>'
    $ReportData = $ReportData -replace $DisabledStatus,$DisabledColorStyle
    ConvertTo-Html -Body "<font color = blue><H4><B>Report </B></H4></font>$ReportData" -Title "Test Report" -CssUri C:\style.CSS | Out-File "E:\Reports\TestReport.html"
    This report shows perfect on system where report file is located at E:\Reports\TestReport.html location as below :
    However , when I send this report via email using following command
    $Report = Get-Content "E:\Reports\TestReport.html"
    Send-MailMessage -To $To -SmtpServer $SMTP -From $From -Subject $Subject -BodyAsHtml "$Report"
    I dont see disabled as red color in email , while table's style is working which is stored at C:\style.CSS
    Would you please let me know the reason behind same ?
    Thanks and Regards,
    Dipti
    Dipti Chhatrapati

    Hi Dipti,
    I‘m writing to check if the suggestions were helpful, if you have any questions, please feel free to let me know.
    If you have any feedback on our support, please click here.
    Best Regards,
    Anna
    TechNet Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Labview code for closing the command window

    Hi,
    This is naveen.Actually we are using 3rd paty test software for our mobile hardware testing which creates an DOS or Command window after execution.We have automated to execute this software using labview.the problem we facing is that we couldn't run the test software unless we close or kill the dos window opened in the previous run.So i like to know whether you have any labview code for closing or killing the DOS window ,i request you help me in this regard.
    regards,
    Naveen 

    Use the System Exec VI Owning Palette: Libraries & Executables VIs and Functions.
    And take a look here http://www.tech-recipes.com/rx/446/xp_kill_windows_process_command_line_taskkill/
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)

  • Finding the code for 'Advanced|Print Production|Output Preview'

    This windows exposes the color separation used in the PDF file. I am looking to create a simple application which compares an order color with its PDF's attachment. This is used by a printer to make sure that the PDF color and the order color match. This application will be silent and only output a match/no match code.
    I have been trying all sort of searches before posting... but I am giving up. My code is in C# or VB. Thanks for helping.
    Jerome Boyer

    There is no access to that information from C#/VB - only from C/C++ (as a plugin).

  • T-Code for Sales order mass output

    Hi Friends,
    I have 150 SOs. In which I need to process the output again. Checked the MASS trx for this but could not find any option?
    Is there any otherway we can process the output at one shot?
    Regards,
    Ram

    Hi,
    Just like we have the T.Code "VF31" for billing documents,we don't have any such T.Code here for "Sales orders".But there is a procedure.
    That is:
    Goto the T.Code "SE38".
    Enter the program name as "RANAST00".
    Execute.
    Enter the application as "V1".
    Enter the output type also.
    Check the tick box "send again".
    Execute.
    Regards,
    Krishna.

  • USER COMMAND CODE for the ICON "Back"

    Hello All,
                 I wanted to know if there is any command code for the user-command icon "back" that i can use while programming.
    e.g. as for the icon "save" there is '&data_save' code which we can use.
    I have used the code "&F03" for 'back" but it does not call the routine i have written for the same.
    So if in case no other code for "Back" icon is available, what is the procedure to implement the "back" command through programming?
    as when i click the icon,the code written inside the report should be executed along with the normal "back" function.
    Thanks

    Hi..
    you do one thing..put /h. then click on back.At the bottom pART of the debugging screen u find
    Field names section..There type sy-ucomm and press enter. The value of sy-ucomm can be seen...
    Thats the value u need...Which u can use the same in case statement
    and its case sensitive.chk the same.. and  write it in quotes( ''). that is 'BACK' or 'F03'
    Edited by: Rudra Prasanna Mohapatra on Jun 21, 2008 7:48 AM

  • How to get source code for commands like diff or cat

    Hi all
    I'm learning c programming and i'd like to read some code for the basic commands on the linux system
    I remember apt has one such option that allows getting pakcage source code
    is there a similar one for pacman ?
    or do i have to search those source code myself ?
    and also in BSD system all the codes are availeble in a code repository
    thx

    diff and cat. Or was that too literal?
    Last edited by Ghost1227 (2009-04-18 23:57:55)

  • Code for control z key in

    hi,
    I have a modem program for which i have to write code for control z command so that the control must be terminated when i click ctrl+z command.can anyone help me.

    hello ramy jothi,
    can u tell m e the url for
    developing mobile gamesPlease seek help for your drug addiction as soon as
    possible.Don't you mean "durg addiction" ?

  • Options for retrieving chats logged by the Presence server?

    If I create my own external PostgreSQL database and tell Presence to log chats and chat room texts to the database, is there a way to retrieve them without writing my own SQL code for retrieval?  
    I know there are 3rd party servers that you can offload your logging to for this purpose but I'm trying to do this without buying another product or having to enlist a SQL DBA.  

    Not really, but the SQL for searching the database for a string like that is pretty straight forward.  I use two queries when I touch the compliance DB at all.  The first finds a string like your Acme, Inc and the second finds messages from a particular user;
    select * from jm where body_string like '%Acme%'
    and
    select * from jm where from_jid = '[email protected]'
    I guess you've either got the need to just find a couple of things like "messages that contain Acme" or "messages from John", or you've got a broader need and then a third party solution is necessary.  The trick is figuring out where on the scale you are.

  • Powershell command to add users to list

    I am looking for a powershell command to add an Active Directory user to a list and set the permission level on the list, e.g. read or contribute.
    Ideally, the script should check if the list is inheriting permissions from the parent and if so, remove the inheritance, clear the list of users and add the specified users.
    Any ideas?

    I haven't tested this but the logic is like below
    $spweb = Get-SPWeb -Identity ("URL")
    $splist = $spweb.Lists['List Name']
    if($splist.Permissions.Inherited)
    Write-Host "Let's Break the inhertiance..."
    $splist.BreakRoleInheritance($true , $true)
    #Role assignment
    $role = $splist.RoleAssignments["Read"]
    #Specific User
    $account = $spweb.EnsureUser('Domain\User')
    #remove assignment
    $assignment = New-Object Microsoft.SharePoint.SPRoleAssignment($account)
    $assignment.RoleDefinitionBindings.Remove($role)
    $splist.RoleAssignments.Remove($assignment)$split.Update()
    else
    $role = $splist.RoleAssignments["Read"]
    $account = $spweb.EnsureUser('Domain\User')
    $assignment = New-Object Microsoft.SharePoint.SPRoleAssignment($account)
    $assignment.RoleDefinitionBindings.Add($role)
    $splist.RoleAssignments.Add($assignment)
    $splist.Update()
    Regards Chen V [MCTS SharePoint 2010]

  • Retrieve all pages in a site collection using powershell command

    Hi all,
    I need to retrieve all pages in a site collection and i wanted to display it in a csv file using powershell command.Please help.
    Regards,
    Praveen

    Hi Praveen,
    Here are two blogs would be helpful:
    PowerShell script to Enumerate Sites, Sub-sites and print them in a .csv file
    http://www.sharepointfix.com/2012/02/powershell-script-to-enumerate-sites.html
    Powershell to Loop through all SharePoint sites and pages
    https://tjendarta.wordpress.com/2013/03/19/powershell-to-loop-through-all-sharepoint-sites-and-pages/
    Best Regards
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Command to generate code for I-phone application in SUP-DOEc

    Hello Experts,
    Please let me know the command to generate code for esdma to create iphone application using SUP-DOEc.
    Thanks and Regards,
    Suma

    codegen <ESDMA directory>\META-INF\sup-db.xml -client -mbs -sqlite u2013oc -log:co -output <ESDMA directory>
    Regards,
    Siva.
    Edited by: Siva Satya Prasad Yerra on Jun 20, 2011 1:33 PM

  • Sample Command Output of show chassis inventory for CSS

    Hi,
    I am trying to get a sample command output of "show chassis inventory" for:
    CSS 11501
    CSS 11503
    CSS 11506
    Can anyone help?
    Thanks in advance.
    Mike

    Hi Mchi,
    When I use the command: show chassis inventory. I found :
    Slot  Module                           Serial
    1     CSS5-SCM-2GE F0   JABxxxxxxx
    2     CSS5-IOM-2GE E0   JAB08xxxxxx
    3     CSS5-IOM-8FE F0   JAB0xxxxxxx
    4     CSS503-SM-INT     JAB09xxxxxxx
    this is the switch fabric module that connects the other modules.
    This is an internal module and it can't be removed/replaced.
    Use the show chassis command to display a chassis configuration for the CSS. The syntax and options for this command are as follows:
    •show chassis - Displays a summary of the chassis configuration.
    •show chassis slot number  - Displays the operational parameters for a slot in a CSS 11503 or CSS  11506 chassis. Enter an integer value for the chassis slot number.
    •show chassis verbose - Displays detailed information about the chassis configuration.
    •show chassis flash - Displays the operational and locked Flash software code on the CSS  11501, and the CSS 11503 or CSS 11506 SCM and I/O modules. An asterisk  (*) character before a Flash version of code and build number indicates  that it is active.
    •show chassis inventory - Displays the physical configuration of the CSS including part and serial numbers.
    •show chassis session-processors - Displays the weight and power summary of the session processors in the CSS chassis.
    CSS11506# show chassis inventory
    Chassis Inventory:
    Product Name:    CSS11506-2AC E0    SW Version:        07.50.1.05s
    Serial Number:   JAB09xxxxxx        Base Mac Address:  00-13-80-37-xx-xx
    Slot  Module            Serial
    1     CSS5-SCM-2GE F0   JAB0915xxxx
    2     CSS5-SCM-2GE F0   JAB0914xxxx
    3     CSS5-SSL-K9 F0    JAB0848xxxx
    4     CSS5-IOM-2GE E0   JAB0808xxxx
    7     CSS506-SM E0      JAB0911xxxx
    8     CSS506-SM E0      JAB0911xxxx
      Even a "show chassis verbose" command does  not indicate the presence of a GBIC.  It shows the Operational Status of  a port as "online" whether there is a GBIC installed or not.  For  example, in the output below Slot 4 has a GBIC installed in port 4/1,  but 4/2 is empty:
    CSS11506# sho chassis verbose
    Configuration for CSS11506-2AC E0:
    Product Name:    CSS11506-2AC E0    SW Version:        07.50.1.05s
    Serial Number:   JAB0916xxxx        Base Mac Address:  00-13-80-37-xx-xx
    Module(s) Found:                   6
    Power Supplies(s) Found:           2
    Fan(s) Found:                      3
    Slot/SubSlot  Operational                  Locked
       1/1        *07.50.1.05                       07.40.1.03
       2/1        *07.50.1.05                       07.40.1.03
       3/1        *07.50.1.05                       07.40.1.03
       4/1        *07.50.1.05                       07.20.2.06
    Slot Number:                       1  Type:       CSS5-SCM-2GE F0
    Serial Number:           JAB0915xxxx  Number of Ports:          2
    Operational Status:          primary
    Port Number:                      1  Port Name:          SCM-2GE
    Operational Status           online
    Port Number:                      2  Port Name:          SCM-2GE
    Operational Status           online
    Slot Number:                       2  Type:       CSS5-SCM-2GE F0
    Serial Number:           JAB0914xxxx  Number of Ports:          0
    Operational Status:           backup
    Slot Number:                       3  Type:        CSS5-SSL-K9 F0
    Serial Number:           JAB0848xxxx  Number of Ports:          0
    Operational Status:          primary
    Slot Number:                       4  Type:       CSS5-IOM-2GE E0
    Serial Number:           JAB0808xxxx  Number of Ports:          2
    Operational Status:          primary
    Port Number:                      1  Port Name:          IOM-2GE
    Operational Status           online
    Port Number:                      2  Port Name:          IOM-2GE
    Operational Status           online
    Slot Number:                       7  Type:          CSS506-SM E0
    Serial Number:           JAB0911xxxx  Number of Ports:          0
    Operational Status:       powered-on
    Slot Number:                       8  Type:          CSS506-SM E0
    Serial Number:           JAB0911xxxx  Number of Ports:          0
    Operational Status:       powered-on
    end of buffer.
    Maybe you can use "show tech"
    HTH
    Sachin

  • Code for command line

    Hello everyone,
    I have a SQL SSIS package that I would like to trigger
    through Cold fusion. I looked into SQL help, it said that using
    "dtexec" at command line will work. My question is: how do I get
    Cold Fusion do a command line job? What is the sytext/code for
    that?
    Thanks in advance.

    Lei Hu wrote:
    > Hello everyone,
    > I have a SQL SSIS package that I would like to trigger
    through Cold fusion.
    > I looked into SQL help, it said that using "dtexec" at
    command line will work.
    > My question is: how do I get Cold Fusion do a command
    line job? What is the
    > sytext/code for that?
    >
    > Thanks in advance.
    >
    The <cfexecute...> tag allows ColdFusion to run command
    line code. It
    can take a lot of trial and error to get that to work
    properly. User
    permissions of the ColdFusion server standard output versus
    standard
    error, version of ColdFusion are all potential hickups with
    this type of
    code.
    Take it slow, one step at the time is the best advice I can
    give you for
    using <cfexecute...>.
    Ian

Maybe you are looking for