Executing DPM Powershell Commands

Hi All,
         I am trying to execute DPM 2012 Powershell commands from a console application in c#, but at the time of Invoke it is giving me the following error.
{"Could not load file or assembly 'ACM, Version=1.0.523.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.":"ACM, Version=1.0.523.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"}
Below is my code.
var runspace = PShell.GetRunSpace();
            if (runspace.RunspaceStateInfo.State == RunspaceState.BeforeOpen)
                runspace.Open();
            var pipeline = runspace.CreatePipeline();
            pipeline.Commands.AddScript("$installPath = (Get-ItemProperty \"HKLM:\\SOFTWARE\\Microsoft\\Microsoft Data Protection Manager\\Setup\" \"UIInstallPath\").UIInstallPath");
            pipeline.Commands.AddScript("$dpmModuleFullPath = $installPath + \"Modules\\DataProtectionManager\\DataProtectionManager.psd1\"");
            pipeline.Commands.AddScript("Import-Module $dpmModuleFullPath");
            pipeline.Commands.AddScript("$pg=get-protectiongroup -dpmserver dpm-2012-01");
            pipeline.Commands.AddScript("$pg");
            try
                System.Collections.ObjectModel.Collection<PSObject> result = pipeline.Invoke();
                foreach (PSObject obj in result)
                    var name = obj.Properties["FriendlyName"].Name;
            catch (Exception e)
ilyas

Hi All,
         I am trying to execute DPM 2012 Powershell commands from a console application in c#, but at the time of Invoke it is giving me the following error.
{"Could not load file or assembly 'ACM, Version=1.0.523.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.":"ACM, Version=1.0.523.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"}
Below is my code.
var runspace = PShell.GetRunSpace();
            if (runspace.RunspaceStateInfo.State == RunspaceState.BeforeOpen)
                runspace.Open();
            var pipeline = runspace.CreatePipeline();
            pipeline.Commands.AddScript("$installPath = (Get-ItemProperty \"HKLM:\\SOFTWARE\\Microsoft\\Microsoft Data Protection Manager\\Setup\" \"UIInstallPath\").UIInstallPath");
            pipeline.Commands.AddScript("$dpmModuleFullPath = $installPath + \"Modules\\DataProtectionManager\\DataProtectionManager.psd1\"");
            pipeline.Commands.AddScript("Import-Module $dpmModuleFullPath");
            pipeline.Commands.AddScript("$pg=get-protectiongroup -dpmserver dpm-2012-01");
            pipeline.Commands.AddScript("$pg");
            try
                System.Collections.ObjectModel.Collection<PSObject> result = pipeline.Invoke();
                foreach (PSObject obj in result)
                    var name = obj.Properties["FriendlyName"].Name;
            catch (Exception e)
ilyas
I have the very same issue, only I am running the script from within PowerGui (www.powergui.org). Was a resolution ever found for this issue?
http://blog.aggregatedIntelligence.com/

Similar Messages

  • Set-DPMGlobalProperty -KnownVMMServers - DPM Powershell command fails

    Hello,
    I must be over looking a step and hope that someone can point out something obvious I am missing.
    We are running SCDPM 2012 SP1 on a Win server 2012 and SCVMM 2012 SP1 on another Win 2012 server.
    I want to setup DPM to automatically protect our VM's when they're migrated around on our Server 2012 Hyper-V hosts.
    The SCDPM2012 Server has the Hyper-V role added and has the SCVMM console installed. The SCVMM console on the SCDPM server and SCVMM server are the same version 2012 SP1 Version 3.1.6018.0.
    The SCDPM agent is installed on the SCVMM server. On the SCVMM server I have granted administrator rights to the SCDPM server account.
    On the SCDPM server I open an Admin elevated powershell and import the dpm modules. When I then try to run Set-DPMGlobalProperty –DPMServerName MyDpmServerName -KnownVMMServers MySCVMMServerName I get the following Error.
    WARNING: Connecting to DPM server: MyDPMServer
    Set-DPMGlobalProperty : DPM was unable to configure and start the VmmHelperService on the DPM Server.
    Server name: MyDPMServer.
    Exception Message: Time out has expired and the operation has not been completed. (ID: 33399)
    1) Verify that VMM Console features are installed on the DPM Server.
    2) To reconfigure the VMM server in DPM, use the Set-DPMGlobalProperty cmdlet as follows:
    Set-DPMGlobalProperty -DpmServerName <DPMServerName> -KnownVMMServers <VMMServerName>.
    At line:2 char:1
    + Set-DPMGlobalProperty –DPMServerName schooldpm02.dundeecity.sch.uk -KnownVMMServ ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Set-DPMGlobalProperty], DlsException
        + FullyQualifiedErrorId : FailedToConfigureVmmHelperService,Microsoft.Internal.EnterpriseStorage.Dls.UI.
       Cmdlet.SetGlobalProperty
    Any help would be greatly appreciated.
    Cheers
    Alex

    The problem could be related to registry permissions.  The DPM VMM Helper service should be running under the NetworkService account and it may not have read/write permissions on the key:  "Software\Microsoft\Microsoft Data Protection Manager\2.0\Configuration"
    Please verify the System/Network Service account has read/write permissions on this registry key and try rerunning the command.
    Thanks,
    Michael Vargo
    -------------------- Regards, Michael V [MSFT] - This posting is provided "AS IS" with no warranties, and confers no rights.

  • Execute powershell commands on a VM from the host.

    I’m wondering if it’s possible to execute PowerShell commands from the host that will be execute on a virtual machine.
    I have around 10 VM and I need to run the same command on all of it and I need to do the same in other 15 host.  
    None of the VM belong to the same domain.

    Yes, it's possible. 
    It's not recommended to do any administrative tasks from the host. You should remove the GUI and all roles from the host except things related to Hyper-V and used in your environment like Failover Clustering and MPIO. 
    As a best practice, set a Windows 8.1 VM as your management station and install RSAT tools on it including Hyper-V Manager. It also comes with Powershell modules you need to run Powershell commands and scripts against all your hosts and VMs.
    On the machines to be managed by Powershell you need to enable Powershell Remoting. In Server 2012 and above and Windows 8 and above this is enabled out of the box (even core versions). In older versions of Windows
    enable Powershell Remoting manually as shown in this post.
    On the management Win 8.1 VM that has RSAT installed, if the managed machines belong to the same domain as the managing station, you're good to go. If not, run this command on the managing station:
    winrm s winrm/config/client "@{TrustedHosts=""My2003Server,host2,host3,vm4""}"
    Execute your scripts against multiple machines by using Invoke-Command as in:
    'Computer1','Computer2','Computer3' | % {
    $Result = Invoke-Command -Computer $_ -ScriptBlock {
    Get-Process
    $Result
    This example, will execute the commands in the scriptblock on each of the 3 computers in line1, and return the result.
    For more information see
    Don Jones' Secrets of Powershell Remoting eBook.
    Sam Boutros, Senior Consultant, Software Logic, KOP, PA http://superwidgets.wordpress.com (Please take a moment to Vote as Helpful and/or Mark as Answer, where applicable) _________________________________________________________________________________
    Powershell: Learn it before it's an emergency http://technet.microsoft.com/en-us/scriptcenter/powershell.aspx http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx

  • Execute powershell command (new-object -comObject ...) in management pack

    Hello everyone
    I have a COM Object that want to use it in my management pack. When I write the powershell command "new-object -comObject ... " to create it outside of MP and in a ps1 file it works without any error. However when I write it in my MP, this
    error is showed in event viewer: "Retrieving the COM class factory for component with CLSID {clsID} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))."
    I have to mention that when I use vb script in my MP and using "CreateObject()", I don't have any problem.
    How can I use "new-object -comObject ... " in my management pack?
    thank you all
    Alireza

    Hi Marthijn,
    Actually I don't have any problem with powershell in my management packs. For example I can use "MOM.ScriptAPI"
    to create $oBag and return it to next module. My problem is only with that custom COM object. Interesting thing is that, it
    works fine when I create it in powershell file outside of MP, but when I create it in my MP, that error occures.
    thank you so much
    Alireza

  • An unknown error occurred while executing the PowerShell script:

    Hello all,
    Not the most descriptive title, granted. I'm hoping this may prompt the next version toprovide additional valuable content.
    Kindly requesting any help on this problem. I'm running VMM 2012 R2 version 3.2.7668
    When I try to look at properties of an existing Private Cloud, I get this error, only if I "look" at certain attributes. If I stay away from the specific attributes, everything is hunky dory. For reasons unknown, after I get this error, I have
    to exit and go back into VMM in order to get anything else to run.
    The text in the error dialogue box is not entirely applicable because I was connected to the VMM server and will connect again, when I exit/relaunch.
    An unknown error occurred while executing the PowerShell script:
    The connection to the VMM management server scvmm2.mmmmmm.com was lost.
    Ensure that scvmm2.mmmmmm.com is online and that you can access the server remotely from your computer. Then connect to scvmm2.mmmmmm.com and try the command again using the new connection. Or, you can ensure that the Virtual Machine Manager service is started
    on scvmm2.mmmmmm.com. Then connect to scvmm2.mmmmmm.com and try the command again using the new connection. If the command fails again because of a connection failure, restart the Virtual Manager service and then try the operation again.
    Try the operation again. If the issue persists, contact Microsoft Help and Support.
    ID: 27235
    This is what I get in Events
    Warning 4/9/2015 3:27:04 PM PowerShell (Microsoft-Windows-PowerShell) 4100 Executing Pipeline
    Log Name:      Microsoft-Windows-PowerShell/Operational
    Source:        Microsoft-Windows-PowerShell
    Date:          4/9/2015 3:27:04 PM
    Event ID:      4100
    Task Category: Executing Pipeline
    Level:         Warning
    Keywords:      None
    User:          mmmmmm\paufra
    Computer:      tools-francis.mmmmmm.com
    Description:
    Error Message = The connection to the VMM management server scvmm2.mmmmmm.com was lost. (Error ID: 1610)
    Ensure that scvmm2.mmmmmm.com is online and that you can access the server remotely from your computer. Then connect to scvmm2.mmmmmm.com and try the command again using the new connection. Or, you can ensure that the Virtual Machine Manager service is started
    on scvmm2.mmmmmm.com. Then connect to scvmm2.mmmmmm.com and try the command again using the new connection. If the command fails again because of a connection failure, restart the Virtual Manager service and then try the operation again.
    Fully Qualified Error ID = 1610,Microsoft.SystemCenter.VirtualMachineManager.Cmdlets.GetSCReplicationGroupCmdlet
    Recommended Action = Ensure that scvmm2.mmmmmm.com is online and that you can access the server remotely from your computer. Then connect to scvmm2.mmmmmm.com and try the command again using the new connection. Or, you can ensure that the Virtual Machine Manager
    service is started on scvmm2.mmmmmm.com. Then connect to scvmm2.mmmmmm.com and try the command again using the new connection. If the command fails again because of a connection failure, restart the Virtual Manager service and then try the operation again.
    Context:
            Severity = Warning
            Host Name = Default Host
            Host Version = 4.0
            Host ID = 94963cd4-5979-4786-9da2-c8814de8c7c3
            Host Application = C:\Program Files\Microsoft System Center 2012 R2\Virtual Machine Manager\Bin\VmmAdminUI.exe
            Engine Version = 4.0
            Runspace ID = 359d7a46-3752-4929-8c09-0de4152d10e4
            Pipeline ID = 16
            Command Name = Get-SCReplicationGroup
            Command Type = Cmdlet
            Script Name =
            Command Path =
            Sequence Number = 91
            User = mmmmmm\paufra
            Shell ID = Microsoft.PowerShell
    User Data:
    Event Xml:
    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
      <System>
        <Provider Name="Microsoft-Windows-PowerShell" Guid="{A0C1853B-5C40-4B15-8766-3CF1C58F985A}" />
        <EventID>4100</EventID>
        <Version>1</Version>
        <Level>3</Level>
        <Task>106</Task>
        <Opcode>19</Opcode>
        <Keywords>0x0</Keywords>
        <TimeCreated SystemTime="2015-04-09T22:27:04.993655700Z" />
        <EventRecordID>285</EventRecordID>
        <Correlation ActivityID="{48059811-1A63-41E1-9057-7498D0E4FC20}" />
        <Execution ProcessID="2344" ThreadID="4076" />
        <Channel>Microsoft-Windows-PowerShell/Operational</Channel>
        <Computer>tools-francis.mmmmmm.com</Computer>
        <Security UserID="S-1-5-21-4008432563-1984933819-4238309236-2721" />
      </System>
      <EventData>
        <Data Name="ContextInfo">        Severity = Warning
            Host Name = Default Host
            Host Version = 4.0
            Host ID = 94963cd4-5979-4786-9da2-c8814de8c7c3
            Host Application = C:\Program Files\Microsoft System Center 2012 R2\Virtual Machine Manager\Bin\VmmAdminUI.exe
            Engine Version = 4.0
            Runspace ID = 359d7a46-3752-4929-8c09-0de4152d10e4
            Pipeline ID = 16
            Command Name = Get-SCReplicationGroup
            Command Type = Cmdlet
            Script Name =
            Command Path =
            Sequence Number = 91
            User = mmmmmm\paufra
            Shell ID = Microsoft.PowerShell
    </Data>
        <Data Name="UserData">
        </Data>
        <Data Name="Payload">Error Message = The connection to the VMM management server scvmm2.mmmmmm.com was lost. (Error ID: 1610)
    Ensure that scvmm2.mmmmmm.com is online and that you can access the server remotely from your computer. Then connect to scvmm2.mmmmmm.com and try the command again using the new connection. Or, you can ensure that the Virtual Machine Manager service is started
    on scvmm2.mmmmmm.com. Then connect to scvmm2.mmmmmm.com and try the command again using the new connection. If the command fails again because of a connection failure, restart the Virtual Manager service and then try the operation again.
    Fully Qualified Error ID = 1610,Microsoft.SystemCenter.VirtualMachineManager.Cmdlets.GetSCReplicationGroupCmdlet
    Recommended Action = Ensure that scvmm2.mmmmmm.com is online and that you can access the server remotely from your computer. Then connect to scvmm2.mmmmmm.com and try the command again using the new connection. Or, you can ensure that the Virtual Machine Manager
    service is started on scvmm2.mmmmmm.com. Then connect to scvmm2.mmmmmm.com and try the command again using the new connection. If the command fails again because of a connection failure, restart the Virtual Manager service and then try the operation again.
    </Data>
      </EventData>
    </Event>

    Hi Sir,
    First , please try to run the VMM configuration analyzer on that computer :
    http://www.microsoft.com/en-us/download/details.aspx?id=41555
    In addition , please try to use "VMMTrace" mentioned in following article to collect trace log and find some useful information :
    http://blogs.technet.com/b/jonjor/archive/2011/01/07/vmmtrace-simplified-scvmm-tracing.aspx
    Best Regards,
    Elton Ji
    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 Subscriber Support, contact [email protected] .

  • Error while Seq vlc in powershell command line.

    Hi Team,
    when i am trying to seq Vlc i got below error in power shell.
    i have entered below command lines in powershell
    1. cd c:\install
    2. Set-ExecutionPolicy Unrestricted
    3. New-AppvSequencerPackage -FullLoad -Installer "C:\Install\vlc-2.1.3-win32.exe" -Name "Unknown_VLC_2.1.3_01_W7_32_A" -Pa
    th C:\Packages -PrimaryVirtualApplicationDirectory "C:\Windows" -TemplateFilePath .\AppV5SequencerTemplate.appvt -Verbo
    se
    after it's called "C:\Install\vlc-2.1.3-win32.exe", i did default install and clicked close button.
    after 5 mint's i got below error.
    could you please help me to solve.
    1. AppV5SequencerTemplate.appvt file present in c:\installer folder
    2. c:\packages folder created
    Thanks in Advance :)
    Ramesh
    PS C:\Install> New-AppvSequencerPackage -FullLoad -Installer "C:\Install\vlc-2.1.3-win32.exe" -Name "Unknown_VLC_2.1.3_01_W7_32_A" -Pa
    th C:\Packages -PrimaryVirtualApplicationDirectory "C:\Windows" -TemplateFilePath .\AppV5SequencerTemplate.appvt -Verbo
    se
    Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indi
    cation that other memory is corrupt.
    at PE.ComputeMinFileRanges(PE* )
    at ResolveDependencies(IPackageFile file, IEnumerable`1 files, Func`4 fnGetDependencyPathFromName, Func`2 fnGetLocalP
    athOfPackageFile, HashSet`1 dependencies, HashSet`1 visited)
    at Microsoft.ApplicationVirtualization.Packaging.PEScanner.BuildDependencies(IEnumerable`1 allPackageFiles, Func`2 pr
    edicate, Func`4 fnGetDependencyPathFromName, Func`2 fnGetLocalPathOfPackageFile)
    at Microsoft.ApplicationVirtualization.Packaging.StaticDependencyPackagingSubsystem.<>c__DisplayClass8.<.ctor>b__0(Ob
    ject sender, CommonPreEventArgs args)
    at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
    at Microsoft.ApplicationVirtualization.Packaging.PackagingEngine.OnFinalizePackage(Func`1 writerFactory)
    at Microsoft.ApplicationVirtualization.Packaging.PackagingEngine.<>c__DisplayClass18.<FinalizePackage>b__12()
    at Microsoft.ApplicationVirtualization.Packaging.WithAppCorruptionCheck.Execute(Action execute, Action`1 logCorruptio
    n)
    at Microsoft.ApplicationVirtualization.Packaging.WithAppCorruptionCheck.Execute(Action execute)
    at Microsoft.ApplicationVirtualization.Packaging.PackagingEngine.<>c__DisplayClass18.<FinalizePackage>b__11()
    at Microsoft.ApplicationVirtualization.Packaging.ExceptionGuard`1.Guard(Action logStart, Action execute, Action logEn
    d, Action`1 exceptionAction)
    at Microsoft.ApplicationVirtualization.Packaging.PackagingEngine.FinalizePackage(Func`1 writerFactory)
    at Microsoft.ApplicationVirtualization.Packaging.Packager.FinalizePackage(IPackageFiles packageFiles, String manifest
    Path, String registryHivePath, String streamMapPath, String packageHistoryPath, String installPath, String installShortP
    ath, String packagePath, CompressionOption compression, Predicate`1 addFileToPublishingFeatureBlock, PackagingEngineType
    engineType, PackagerParameters packageParameters)
    at Microsoft.ApplicationVirtualization.Packaging.Sequencing.PackagerAdapter.FinalizePackage(IPackageFiles packageFile
    s, String manifestPath, String registryHivePath, String streamMapPath, String packageHistoryPath, String installPath, St
    ring packagePath, CompressionOption compression, PackagerParameters packagerParameters)
    at Microsoft.ApplicationVirtualization.Packaging.Sequencing.PackagerOrchestrator.FinalizePackage(String streamMapPath
    , String packagePath, String manifestPath, String registryHivePath, String packageHistoryPath, String installPath, Compr
    essionOption compression, Boolean toAppendVersionNumberToFileName, PackagerParameters packagerParameters)
    at Microsoft.AppV.Modernizer.Cmdlets.NewAppvSequencerPackage.CreatePackageViaInstaller(String packageName, String out
    putDirectoryPath, String primaryApplicationVirtualDirectory, String installer, String templatePath, Boolean fullLoad, Fu
    nc`1 fnSequencerFactory, Func`2 fnMonitoringSessionManagerFactory, Func`1 fnSequencerStateFactory, Func`2 fnTaskScannerA
    dapterFactory, Func`2 fnPackagerOrchestratorFactory, Func`1 fnSequencerTemplateFactory, Func`2 fnExclusionListFactory, A
    ction`1 fnWait, Action fnConfigurePrivileges, Func`2 fnOutputDirectoryExists, Func`2 fnOutputSubdirExists, Action`1 fnCr
    eateDirectory)
    at Microsoft.AppV.Modernizer.Cmdlets.NewAppvSequencerPackage.CreatePackageViaInstaller(String packageName, String out
    putDirectoryPath, String primaryApplicationVirtualDirectory, String installer, String templatePath, Boolean fullLoad)
    at Microsoft.AppV.Modernizer.Cmdlets.NewAppvSequencerPackage.NewPackage()
    at Microsoft.AppV.Modernizer.Cmdlets.NewAppvSequencerPackage.<ProcessRecord>b__1()
    at Microsoft.AppV.Modernizer.Cmdlets.ExceptionGuard.Guard(Action logStart, Action execute, Action logEnd, Action`1 er
    rorAction)
    at Microsoft.AppV.Modernizer.Cmdlets.NewAppvSequencerPackage.ProcessRecord()
    at System.Management.Automation.CommandProcessor.ProcessRecord()
    at System.Management.Automation.CommandProcessorBase.DoExecute()
    at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input, Hashtable errorR
    esults, Boolean enumerate)
    at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInterna
    l[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcCo
    ntext)
    at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
    at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
    at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
    at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean crea
    teLocalScope, Dictionary`2 functionsToDefine, List`1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Obj
    ect dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)
    at System.Management.Automation.ScriptBlock.<>c__DisplayClassa.<InvokeWithPipe>b__8()
    at System.Management.Automation.Runspaces.RunspaceBase.RunActionIfNoRunningPipelinesWithThreadCheck(Action action)
    at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, Dictionary`2 functionsToDefine, Lis
    t`1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis,
    Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)
    at System.Management.Automation.ScriptBlock.InvokeUsingCmdlet(Cmdlet contextCmdlet, Boolean useLocalScope, ErrorHandl
    ingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Object[] args)
    at Microsoft.PowerShell.Commands.InvokeExpressionCommand.ProcessRecord()
    at System.Management.Automation.CommandProcessor.ProcessRecord()
    at System.Management.Automation.CommandProcessorBase.DoExecute()
    at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input, Hashtable errorR
    esults, Boolean enumerate)
    at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInterna
    l[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcCo
    ntext)
    at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
    at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
    at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
    at System.Management.Automation.DlrScriptCommandProcessor.RunClause(Action`1 clause, Object dollarUnderbar, Object in
    putToProcess)
    at System.Management.Automation.CommandProcessorBase.DoComplete()
    at System.Management.Automation.Internal.PipelineProcessor.DoCompleteCore(CommandProcessorBase commandRequestingUpstr
    eamCommandsToStop)
    at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input, Hashtable errorR
    esults, Boolean enumerate)
    at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInterna
    l[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcCo
    ntext)
    at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
    at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
    at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
    at System.Management.Automation.DlrScriptCommandProcessor.RunClause(Action`1 clause, Object dollarUnderbar, Object in
    putToProcess)
    at System.Management.Automation.CommandProcessorBase.DoComplete()
    at System.Management.Automation.Internal.PipelineProcessor.DoCompleteCore(CommandProcessorBase commandRequestingUpstr
    eamCommandsToStop)
    at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input, Hashtable errorR
    esults, Boolean enumerate)
    at System.Management.Automation.Runspaces.LocalPipeline.InvokeHelper()
    at System.Management.Automation.Runspaces.LocalPipeline.InvokeThreadProc()
    at System.Management.Automation.Runspaces.PipelineThread.WorkerProc()
    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object
    state, Boolean preserveSyncCtx)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, B
    oolean preserveSyncCtx)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Threading.ThreadHelper.ThreadStart()
    PS C:\Install>

    Thanks for your replay
    i have re- seq'd it's working..
    Thanks
    Er Reddy

  • PowerShell command returned an exception. Unexpected token 's' in expression or statement

    Hi All,
    I am trying to Creating a VM based on a Template in VMM through Orchestrator Runbook using below URL;
    http://blogs.catapultsystems.com/lrayl/archive/2013/07/03/orchestrator-system-center-integrations-part-3-creating-a-vm-based-on-a-template-in-vmm.aspx
    Runbook:
    But at the Create VM from Template activity runbook will failed:
    Throwing below error in while running runbook in Error Summary text:
    PowerShell command returned an exception. Unexpected token 's' in expression or statement.
    Exception: InvalidOperationException
    Target site: PSRunspaceInvoker.HandleInvokeException
    Stack trace:
       at Microsoft.SystemCenter.Orchestrator.Integration.PowerShellConnector.PSRunspaceInvoker.HandleInvokeException(Exception ex, ILogger logger)
       at Microsoft.SystemCenter.Orchestrator.Integration.PowerShellConnector.PSRunspaceInvoker.Invoke(RunspaceInvoke runspace, String script, ILogger logger)
       at Microsoft.SystemCenter.Orchestrator.Integration.PowerShellConnector.PSScriptRunner.Execute(String script)
       at Microsoft.SystemCenter.Orchestrator.Integration.VMM2012Domain.VM.CloneFromTemplate(String vmmServer, ParameterList inputParameters)
       at Microsoft.SystemCenter.Orchestrator.Integration.VMM2012QIK.VM.CloneFromTemplate.DoExecute(IActivityRequest request, ILogger logger)
       at Microsoft.SystemCenter.Orchestrator.Integration.VMM2012QIK.ActivityBase`2.Execute(IActivityRequest request, IActivityResponse response)
    Both Orchestrator & SCVMM powershell are set on Unrestricted powershell.
    Kindly suggest any solution or work around for resolution.
    Thanks Rahul$

    This may be a bit late and perhaps not even relevant but I came across this post when trying to solve an issue I had with a powershell script in Orchestrator. Maybe it will help you, or maybe it will help someone else.
    I was trying to create a connector between SCOM and our ticketing system. I wanted to export alert descriptions and in the process of testing I came across an alert description that had multiple lines and all kinds of crazy formatting. When I tried to assign
    the Published Data to a varialbe in my powershell script i would get an error "Unexpected token [a partial alert description] in expression or statement.". After looking at the actual alert description data and seeing that i was only getting some of it
    and not all of it it dawned on me that i somehow needed to escape out of all the crazy quoting, carriage returns, and special characters. to do that i assigned the Published Data to a variable in my powershell script as follows:
    $Description = @"
    {Description from "Get Alert"}
    Apparently the @" "@ is called a here-string. Somewhat interesting. Hope it helps you or someone else!

  • How to Stop the powershell command execution in C#

    I am executing powershell command synchronously. Binded a eventhandler, which
    runs successfully when data is emitted by pipeline. When some condition met, i wish to stop powershell command execution,
    but when i call pipeLine.Stop(), program just hangs indefinitely. May i know what is going wrong?
    Command shellCommand = new Command("Get-MsolUser");
    Pipeline pipeLine = powerShellRunspace.CreatePipeline();
    pipeLine.Commands.Add(shellCommand);
    pipeLine.Input.Close();
    pipeLine.Output.DataReady += delegate(object sender,EventArgs args) {
    try {
    PipelineReader<PSObject> output = sender as PipelineReader<PSObject>;
    if (output != null) {
    bool isCompleted = false;
    while (output.Count > 0 && !isCompleted) {
    PSObject pso = (PSObject)output.Read();
    isCompleted = addDataDelegate(pso);
    if (isCompleted) {
    pipeLine.Stop(); //HANGS HERE
    log("JUST STOPPED PIPELINE..");
    } catch(Exception ex) {
    log(ex.ToString());
    pipeLine.Invoke();

    You may need to switch to InvokeAsync. I can't find any documentation on this, so it may come down to trial and error, but the synchronous Invoke method may not be playing well with attempts to call pipeLine.Stop().

  • Context Menu to Execute a powershell script within selected directory.

    Hi,
    I'm trying to run a powershell script from a context menu, I've been able to create a context menu, however, when I attempt to run the script it will only run at the default location. What I'd like to do is right-click a folder then click "Do Script"
    and have it run the script with the location set to the directory I right clicked.
    So for clarities sake, if I right click C:\example then when the script runs it should recognize .\ as C:\example
    This is what I currently have in my registry entry. However it's shouting about how there is no parameter for Set-Location that matches -File, I can see that it's taking the Set-Location command, then it's trying to see if -File will is a perameter for it,
    but I' trying to use -File for the powershell command. Anyone have any ideas for that?
    PowerShell -Command "Set-Location -LiteralPath '%V'" -File C:\script\Test.ps1
    Any ideas? I'm wondering if there is something in Powershell like how Bash has something like this to do commands inline
    $ > Command -parameter <arg> && Command -parameter <arg>

    To setup a script to launch in a men from within a context menu you must create a the following.
    Create the following keys:
    HKEY_CLASSES_ROOT\Directory\Shell\<Script Name>
    HKEY_CLASSES_ROOT\Directory\Shell\<Script Name>\command
    Within <Script Name> change the (Default) value to the words you want to have as a context menu example, "Launch Script Here".
    Within the command Key change the (Default) value to
    PowerShell.exe -File "C:\Script_location\script_name.ps1" "%v"
    PowerShell.exe is executed with the -File flag followed by the scripts exact location and "%v " is a variable pointing to the location that was selected.

  • Executing sharepoint Powershell through C#

    I was writing a console application to execute nctrl status command through a C# program. I wrote a piece of code adding reference to "System.Management.Automation" and create a powershell instance . But the program does not recognise the command
    "nctrl status" . Even i tried adding snapin through AddScript command in the program.. but it failed. One thing i observed is "powershell.create " command opens command prompt 32 bit. I think this is the problem. How can i make it open
    "Powershell for sharepoint". Any suggestions...?

    http://social.technet.microsoft.com/Forums/en-US/14f418e9-71db-4d7e-a83f-c95bf7567c8c/how-to-use-powershell-script-api-in-c-for-sharepoint?forum=sharepointdevelopmentprevious
    Please take a look at this console application that works fine for me. But bear in mind that if you are using Share Point commands your project must be compiled to target either x64 platform or Any CPU platform
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Management.Automation;
    using System.Management.Automation.Runspaces;
    namespace ConsoleApplication1
    class Program
    staticvoid Main(string[] args)
    Runspace runspace = RunspaceFactory.CreateRunspace(InitialSessionState.CreateDefault());
    runspace.Open();
    string script = "Get-SPSite";
    PowerShell powerShellCommand = PowerShell.Create();
    powerShellCommand.Runspace = runspace;
    powerShellCommand.AddScript("Add-PsSnapin Microsoft.SharePoint.PowerShell");
    powerShellCommand.AddScript(script);
    foreach (string result in powerShellCommand.Invoke<string>())
    Console.WriteLine(result);
    runspace.Close();
    }http://social.msdn.microsoft.com/Forums/en-US/88b11fe3-c218-49a3-ac4b-d1a04939980c/how-to-programmatically-execute-the-sharepoint-powershell-commands-ie-using-sharepoint-management?forum=sharepointgeneralprevioushttp://blogs.technet.com/b/speschka/archive/2010/08/11/using-powershell-for-sharepoint-2010-in-c.aspx

  • How to Execute Power Shell Command From Windows Application.

    Hi All Experts,
    I want to execute power shell commands from my windows application.
    Is it possible ?
    Please let me know your comments..
    Thanks.

    I have not tried this, but apprently it is easy as in the sample pasted below. please see this article for more details
    http://geekswithblogs.net/Norgean/archive/2012/09/19/running-powershell-from-within-sharepoint.aspx.
    Let me know how it goes...
    public string RunPowershell(string powershellText, SPWeb web, string param1, string param2) {
    // Powershell ~= RunspaceFactory - i.e. Create a powershell context
    var runspace = RunspaceFactory.CreateRunspace();
    var resultString = new StringBuilder();
    try
    // load the SharePoint snapin - Note: you cannot do this in the script itself (i.e. add-pssnapin etc does not work)
    PSSnapInException snapInError;
    runspace.RunspaceConfiguration.AddPSSnapIn("Microsoft.SharePoint.PowerShell", out snapInError);
    runspace.Open();
    // set a web variable.
    runspace.SessionStateProxy.SetVariable("webContext", web);
    // and some user defined parameters
    runspace.SessionStateProxy.SetVariable("param1", param1);
    runspace.SessionStateProxy.SetVariable("param2", param2);
    var pipeline = runspace.CreatePipeline();
    pipeline.Commands.AddScript(powershellText);
    // add a "return" variable
    pipeline.Commands.Add("Out-String");
    // execute!
    var results = pipeline.Invoke();
    // convert the script result into a single string
    foreach (PSObject obj in results)
    resultString.AppendLine(obj.ToString());
    finally
    // close the runspace
    runspace.Close();
    // consider logging the result. Or something.
    return resultString.ToString();
    Ok. We've written some code. Let us test it.
    var runner = new PowershellRunner();
    runner.RunPowershellScript(@"
    $web = Get-SPWeb 'http://server/web' # or $webContext
    $web.Title = $param1
    $web.Update()
    $web.Dispose()
    ", null, "New title", "not used");
    -Sangeetha

  • Custom SharePoint 2010 designer page throws "The data source control failed to execute the insert command" exception while adding the new item after the August 13, 2013 CU has installed

    We have the SharePoint Server 2010 with SP1 environment on which the custom SP2010 designer pages were working as expected before the
    August 13, 2013 CU has installed. But, getting the below exception while trying to add the new item after the CU has installed.
    Error while executing web part: System.NullReferenceException: Object reference not set to an instance of an object.     at Microsoft.SharePoint.WebControls.SPDataSourceView.ExecuteInsert(IDictionary values)     at
    System.Web.UI.DataSourceView.Insert(IDictionary values, DataSourceViewOperationCallback callback) 3b64c3a0-48f3-4d4a-af54-d0a2fc4553cc
    06/19/2014 16:49:37.65  w3wp.exe (0x1240)                        0x1300 SharePoint Foundation        
     Runtime                        tkau Unexpected Microsoft.SharePoint.WebPartPages.DataFormWebPartException: The data source control
    failed to execute the insert command. 3b64c3a0-48f3-4d4a-af54-d0a2fc4553cc    at Microsoft.SharePoint.WebPartPages.DataFormWebPart.InsertCallback(Int32 affectedRecords, Exception ex)     at System.Web.UI.DataSourceView.Insert(IDictionary
    values, DataSourceViewOperationCallback callback)     at Microsoft.SharePoint.WebPartPages.DataFormWebPart.FlatCommit()     at Microsoft.SharePoint.WebPartPages.DataFormWebPart.HandleOnSave(Object sender, EventArgs e)    
    at Microsoft.SharePoint.WebPartPages.DataFormWebPart.RaisePostBackEvent(String eventArgument)     at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)     at System.Web.UI.Page.ProcessRequestMain(Boolean
    inclu... 3b64c3a0-48f3-4d4a-af54-d0a2fc4553cc
    06/19/2014 16:49:37.65* w3wp.exe (0x1240)                        0x1300 SharePoint Foundation        
     Runtime                        tkau Unexpected ...deStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 3b64c3a0-48f3-4d4a-af54-d0a2fc4553cc
    I have tried changing the "DataSourceMode" as below, now the insert command is working, but update command is not working.
    <SharePoint:SPDataSource runat="server" DataSourceMode="ListItem" />
    Also, the lookup dropdown fields are displaying the value as "<a href="Daughterhttp://cpsp10/sites/Employees/_layouts/listform.aspx?PageType=4&ListId={8F62F444-FB6A-4F03-9522-C4696B45DCD1}&ID=10&RootFolder=*">Daughter</a>"
    instead of only "Daughter".
    Please provide the solution to get rid of this issue.
    Thanks
    Ramasubbu

    Try below:
    http://social.technet.microsoft.com/Forums/en-US/ae910269-3a0c-4506-844b-e8bc89d95b71/data-source-control-failed-to-execute-the-insert-command
    http://blog.jussipalo.com/2012/01/sharepoint-2010-data-source-control.html
    While there can be many causes for this generic error message, in my case the first parameter or ddwrt:DataBind function inside the SharePoint:FormFields element was
    'i' and I was working with an Edit Form. Changing it to
    'u' as it was with every other FormField fixed the issue.
    <SharePoint:FormField runat="server" id="ff1{$Pos}" ControlMode="Edit" FieldName="Esittaja" __designer:bind="{ddwrt:DataBind('u',concat('ff1',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Esittaja')}"
    />
    Explanation:
    DataBind operation type parameters (the first parameter) are listed below:
    'i' stands for INSERT,
    'u' stands for UPDATE,
    'd' stands for DELETE.
    http://webcache.googleusercontent.com/search?q=cache:d9HHY4I7omgJ:thearkfloats.blogspot.com/2014/03/sharepoint-2010-data-source-control.html+&cd=4&hl=en&ct=clnk&gl=in
    If this helped you resolve your issue, please mark it Answered

  • We are trying to implement a process so that any document that needs to be printed through our Java application will be printed as PDF using Adobe Reader. For which, We created and execute the below command line to call Adobe Reader and print the PDF on a

    We are trying to implement a process so that any document that needs to be printed through our Java application will be printed as PDF using Adobe Reader. For which, We created and execute the below command line to call Adobe Reader and print the PDF on a printer."C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe" /T "\\<Application Server>\Report\<TEST.PDF>" "<Printer Name>". Current Situation: The above command line parameter when executed is working as expected in a User's Workspace. When executed in a command line on the Application Server is working as expected. But, the same is not working while executing it from Deployed environment.Software being used: 1. Adobe 11.0 enterprise version. 2. Webshpere Application Server 8.5.5.2. Please let us know if there is a way to enable trace logs in Adobe Reader to further diagnose this issue.

    This is the Acrobat.com forum.  Your question will have a much better chance being addressed in the Acrobat SDK forum.

  • Issue while executing the discovery command from target nodes

    Hi Experts.
    I had to create cluster two node using openfile, after creation of successful lun and associated partition from all the nodes i have changed the ip address of openfiler.
    After changing the IP on open filer.
    A) openfile version:-
    [root@san ~]# uname -r
    2.6.26.8-1.0.11.smp.pae.gcc3.4.x86.i686
    B) Linux Oel5:-
    [root@rac1 ~]# uname -r
    2.6.18-194.el5xen
    [root@rac1 ~]#
    1:- I am able to ping and ssh etc from any node to openfiler.
    However, while executing the below command i am facing the below exception..
    service iscsi restart
    Stopping iSCSI daemon:
    iscsid dead but pid file exists [  OK  ]
    Starting iSCSI daemon: [  OK  ]
    [  OK  ]
    Setting up iSCSI targets: iscsiadm: No records found!
    [  OK  ]
    [root@rac1 ~]#
    Moreover, tried to discover the targets, unfortunately no message is getting displayed after execution of this below command.
    [root@rac1 ~]# iscsiadm -m discovery -t sendtargets -p 192.168.37.200
    [root@rac1 ~]#
    The quick response will be appreciated as my whole test case is down as of now due storage issues.
    Thanks,
    Arch.

    Are you running a firewall that needs to be adjusted to support your changed Openfiler IP network?

  • Executing an OS command !!

    Hi
    Have anyone tried executing an OS command in UNIX(AIX) with SP12 File/FTP adapter ?
    We have created a shell script , ve given execute permissions for all(chmod 777) and tried executing it using file adapter , but we dont see it working.
    Ve referred to  the weblog & few forum threads, but could'nt get to work
    checked an SAP note , but all it talks abt is the way the implementation has been changed from SP13 . Does this mean it never works in SP12 ? pls let know
    Regards
    Saravana

    Hi Saravan,
    You can try  writing a log to another file for each command in your shell script. Atleast you would know why exactly the command is failing.
    Something similar to this inside your script itself..
    /people/michal.krawczyk2/blog/2005/08/17/xi-operation-system-command--error-catching
    Regards
    Anand

Maybe you are looking for

  • Apple TV sound bad when home sharing from Itunes

    Hello All, When I go through the Apple TV menus to Computers and choose my library to play my music it sounds really bad. Almost a "tinny" or metallic sound and the voices sound faded back. Not sure how to fix this or if this is the best way to play

  • Mini Month views

    I seem to be able to only view the mini months as previous month>current month. Is there a way to show current month>next month?

  • Yokogawa UT driver for LabWindows/CVI 6.0 won't translate to LabVIEW 8.6?

    The device driver for the Yokogawa UT series furnace controllers is in LabWindows/CVI 6.0 and I would like to use it in LabVIEW. I tried to use the utility to convert from LabWindows/CVI to LabVIEW, but it said it couldn't and that the device driver

  • I too am having problems with

    I have a soundblaster 5. audio card and Logitech X530 5. speakers. Center, front left, front right, and sub all work. Rear speakers have no sound. When I enter the Creative Sound Mixer, I only have option for 2. speakers. I have tried updating soundb

  • Obviously, it is Oracle's misplay

    In Oracle 11g's document Data Guard Concepts and Administration(about how to create a standby database), it mentions:"configure Listener on both side using Oracle Net Manager". But it never mentions installing the Oracle database soft first on the st