Creating enhanced detection method via powershell

Hi folks,
im trying to automate the application creation process and so far I got a lot of usefull hints and tipps from technet forum etc.pp.
I would like to set an registry detection method via powershell.
Since I am not used to C# I found a nice approach translating a C# script into PS script.
http://social.technet.microsoft.com/Forums/de-DE/93bddee4-6aee-4641-b104-170968ad1549/automating-application-creation?prof=required
Unfortunately I can't get it to work... (same error as descriped in the link above "generic Error from the Put()-Function.") When I am using e.g. an MSI productcode as detection method in my script, I am able to create an application with
deploymenttype and detectionmethod.
Has anyone a solution for this problem ? Or was anyone able to set a registry detection via powershell ? Is it possible ?
Any help will be appreciated.

Any time I've seen a Put() error, the problem has been I've been missing a needed property.
If you are using Config Manager 2012 R2 (Not sure about previous versions), you can use the built in cmdlet Add-CMDeploymentType.  This is the command I use.  For a PS detection type, change ScriptType to Powershell and $Script will be your detection
script.
$param = @{ApplicationName=$Name
                DeploymentTypeName=$ScriptName
                InstallationProgram=$Install
                ScriptType="VBScript"
                ScriptContent=$Script
                InstallationBehaviorType="InstallForSystem"
                ContentLocation=$SourceLocation
                UninstallProgram = $Uninstall
                LogonRequirementType="WhetherOrNotUserLoggedOn"
                InstallationProgramVisibility="Hidden"
        Add-CMDeploymentType @param -ScriptInstaller -ManualSpecifyDeploymentType -DetectDeploymentTypeByCustomScript

Similar Messages

  • Create New Azure Subscription via PowerShell Enterprise Portal

    Hi all,
    I've got a scenario where we are working with a customer who has access to Windows Azure. They are looking to programmatically create new Windows Azure subscriptions for teams from Orchestrator runbooks.
    I know that you can use the Windows Azure PowerShell Cmdlets to do almost anything imaginable with Windows Azure Portal but there doesn't seem to be anything for PowerShell or automation for the Enterprise Portal where I would go to create these
    new subscriptions.
    Is there anything out there for the Enterprise Portal that I've missed?
    Richard Green | MCSA 2012, MCSE 2003, MCTS Desktop Virtualization, VCP5-DV http://richardjgreen.net

    Currently there's no API or PowerShell cmdlet that allow us to create subscriptions programmatically. Please understand you can't simply create a subscription whenever you want. You need to bypass some verifications, such as credit card. You should also
    be careful when creating subscriptions, as that might affect your billing method. Each subscription will result in a separate bill (although they can use the same credit card, as the case of enterprise agreement). In most cases, you can't let a user to use
    PowerShell to create a subscription as he wants. Instead, there should be an approval process. However, you can try to submit a feature suggestion at: http://feedback.windowsazure.com/forums/34192--general-feedback  

  • Create override for monitors via powershell

    I'll cut to the chase, i've already got a powershell script for OVERRIDING rules, but I now need one to do the same for Monitors. I also want to be clear that I do not wish to disable them. My reason for doing this is to stop monitoring for SQL, thus allowing
    me to decide what I'd like to monitor and turn things back on one at a time.
    I've already searched this forum and found numerous topics, all pretty much saying that's not possible. But these were topics from a few years ago, so I'm just seeing if anyone else has come across a way to do this more recently.
    I'm using SCOM 2012 R2, running Powershell v3. 
    Dave.

    So the script I'm running is:
    $Product = 'Microsoft.SQLServer.2012'
    $list = Get-SCOMRule | Where-Object {$_.ManagementPackName -like "$($Product)*"}
    foreach ($rule in $list) {
    C:\scripts\CreateOverride.ps1 –ManagementServer ‘ManagementServer’ –ManagementPackID "($Product)_Overrides" –WorkflowID $rule.name –PropertyName ‘Enabled’ –PropertyValue ‘False’ –Enforced ‘True’ –ContextID ‘Microsoft.Windows.Server.Computer’
    Not the easiest thing to read, but the CreateOverride.ps1 is in the fact the script from the blog. This works perfectly for Rules. It will run through, identify every Rule for SQLServer 2012 and override them to FALSE.
    My problem is, I'm having an issue doing this for Monitors. Mainly because 'ManagementPackName' isn't a valid property for a Monitor.

  • Creating a new method in an enhanced component class implemetation

    Hello Experts,
    I am trying to create a new method in the enhanced component(BT115IT_SLSO) implementation class ( ZL_BT115IT__ITEMS_IMPL)to run our custom functionality. But somehow when I put a breakpoint and debug while I add a product to the sales order the method doesnt get trigerred.
    Is there some thing which I have to do  get this trigerred ? I just added a ned method and placed some custom code in it. Do I have to invoke it anywhere ?
    Pls help me out. I am new to Web UI.
    Thanks

    Hi Mavrick,
    As you are performing some action like item addition , there you need a method called as " event handler " to handle the event and perform the required actions.
    Place a break point in DO_HANDLE_EVENT method , and you will know the exact event handler method which is getting triggered . or if you are defining a new event ( by adding any new button) you should create a event handler method using wizard giving the same name which is defined on_click field of the button as it is case sensitive.
    Regards,
    Nithish

  • View not copied or enhanced with wizard Error while creating Event Handler method in Z Component

    Hello Friends,
    In one Z Component (Custom Component), in one of the views, while creating event handler, it gave me error message that view not copied or enhanced with wizard.
    I am aware that in Standard Component, if we want to create the event handler method then we need to first Enhance the Component and then we need to enhance the view.
    But, in the Z Component (Custom Component), how to create event handler method in one of the views as while creating event handler method i am getting view not copied or enhanced with wizard error.

    Hi,
    Add a method in views impl class with naming convention eh_on__* with htmt and html_ex parameters.  I dont have have the system right now. Please check any existing event import export parameters.
    Check out do handle event method in the same class.
    Redefine that method.  Call that event method in this handle method. See existing code for reference.
    Attach that event to the button on click event in .htm page.
    Regards,
    Bhushan

  • Create MP via Powershell in SCOM 2012 SP1

    Is it possible to create MP via Powershell in SCOM 2012 SP1? If so, how?
    (New-SCOMManagementPack is unrecognized cmdlet) 

    $name="NewMP"
    $displayname="NewMP"
    $mpStore = New-Object Microsoft.EnterpriseManagement.Configuration.IO.ManagementPackFileStore
    $mp = New-Object Microsoft.EnterpriseManagement.Configuration.ManagementPack($name, $displayName, (New-Object Version(1, 0, 0,0)), $mpStore)
    import-scommanagementpack $mp

  • How to Add Multiple Driver Packages Using Reference File via PowerShell

    Hey All - 
    I've got a task I'm working on which would be much easier via PowerShell.  I tried figuring it out, but couldn't so thought I'd post.
    The Task
    I need to create about 50 new, empty driver packages (most are in the same folder in the console) and am trying to find a method of doing so where I may use a source text file / csv file as reference in the command line.  Each package has a unique name
    and source path.  Here are examples:
    - Latitude E5440 Win7 x86 [A01]   \\server\drivers\5440x86
    - Latitude E5440 Win7 x64 [A01]   \\server\drivers\5440x64
    The Structure
    All of the ones I want to add via PowerShell will go into the same folder in the console.  They will be in the folder "root\New Drivers\Dell CAB Drivers" 
    Any ideas or will this just take more time than it's worth for 50?  Thanks!
    Ben K.

    Also, the creation of the driver package won't be your biggest challenge, as it's as simple as New-CMDriverPackage (see:
    http://technet.microsoft.com/en-us/library/jj821724(v=sc.20).aspx).
    The biggest challenge is relating your models to a share name (unless they're all Latitude).
    My Blog: http://www.petervanderwoude.nl/
    Follow me on twitter: pvanderwoude

  • Detection method - file NOT exist?

    I have a need to remove the Outlook feature from Office 2013 if it is present on certain machines. I create my MSP to remove Outlook and run msiexec /p removeoutlook.msp and it works great.
    My problem is that the detection method for applications is the opposite of what I need. If the Outlook.exe file is NOT present, then it is installed.
    I'm sure there must be a way to do this via the custom detection script but I am a scripting noob.

    You can create a 'dummy' application "Outlook 2013", configure it as follows:
    Leave install command blank
    Configure uninstall command to use your detection method (outlook.exe exists)
    Deploy the Uninstall to the collection where you want to remove the outlook
    Or you could use simple package/program to just remove the outlook by running your uninstallation command. Or you could configure your Office 2013 with OCT (Office Customization Tool by running setup.exe /admin) to remove Outlook from your Office 2013 installation
    for future deployments.

  • Deploying Lync 2013 client and SCCM Detection method

    So I am deploying the stand alone Lync 2013 client via SCCM 2012 R2, I have used OCT to create a .MSP, and I am trying to import it into SCCM.  However, I am curious as to what others are using for the Detection method?  Normally I would just
    use the MSI code, but since there is no single MSI, that is not possible with this particular version?  I'm not sure what the best method would be, Option 1 is to find a registry key that is installed by Lync, or Option 2, use a file, maybe Lync.exe under
    the Program Files?

    From the testing I've done Lync creates this reg location...
    HKLM>Software>Microsoft>Office>15.0>Lync
    Try using one of the keys in there, or you could use the file version but not sure if this would change with updates.

  • Error while creating a overwrite method in class

    Hello.
    I'm trying to create an overwrite method in the class CL_HREIC_EECONTACT2SRCHV_IMPL but it just won't let me. Every time I try I get the message "The class has not yet been converted to the new class-local types" and I cannot create it.The thing is I've tried to create overwrite methods in diferent classes and sometimes I get the message and sometimes I don't, so it seems to depend on the class I'm trying to enhance, but I don't seem to be able to see any pattern in it.
    Any help?
    Thanks

    Hello i had the same problem and i couldn't create enhancement pre or post methods.
    The message was:
    The class has not yet been converted to the new class-local types
    Exception of class CX_ENH_OLD_LOCAL_CLASS_TYPES
    This can be fixed by entering in SE24 transaction: Change class. From menu choose: Utilities -> Convert class-local types.
    After that activate the class.
    Now the class can be enhanced.
    However this action requires change of the class
    Regards,
    Rosen

  • Creating a Scheduled Task using PowerShell v4

    So here is my question.  I'm trying/wanting to create a scheduled task using PowerShell v4 on Server 2012R2.  I want to task to run on the 1st day of every month.  The parameter for -Monthly -Day is not available.  I need to use PowerShell
    to create the Scheduled Task because the Task will be running with a group Managed Service Account credentials so the Scheduled Task can not be created via the Task Scheduler GUI.
    Thanks in Advance

    Here is a functioning task It can be easily edited in PowerShell or in notepad to alter the timing
    <?xml version="1.0" encoding="UTF-16"?>
    <Task version="1.1" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
    <RegistrationInfo>
    <Author>W8TEST\user01</Author>
    </RegistrationInfo>
    <Triggers>
    <CalendarTrigger>
    <StartBoundary>2014-06-04T21:31:32.0459499</StartBoundary>
    <Enabled>true</Enabled>
    <ScheduleByMonth>
    <DaysOfMonth>
    <Day>1</Day>
    <Day>12</Day>
    <Day>24</Day>
    </DaysOfMonth>
    <Months>
    <January />
    <February />
    <March />
    <April />
    <May />
    <June />
    <July />
    <August /
    <September />
    <October />
    <November />
    <December />
    </Months>
    </ScheduleByMonth>
    </CalendarTrigger>
    </Triggers>
    <Principals>
    <Principal id="Author">
    <RunLevel>LeastPrivilege</RunLevel>
    <UserId>W8TEST\jvierra</UserId>
    <LogonType>InteractiveToken</LogonType>
    </Principal>
    </Principals>
    <Settings>
    <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
    <IdleSettings>
    <StopOnIdleEnd>true</StopOnIdleEnd>
    <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <Enabled>true</Enabled>
    <Hidden>false</Hidden>
    <RunOnlyIfIdle>false</RunOnlyIfIdle>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>P3D</ExecutionTimeLimit>
    <Priority>7</Priority>
    </Settings>
    <Actions Context="Author">
    <Exec>
    <Command>notepad.exe</Command>
    <Arguments>test.txt</Arguments>
    <WorkingDirectory>c:\temp</WorkingDirectory>
    </Exec>
    </Actions>
    </Task>
    I have edited and reloaded the XML many, many times.  It works very nicely.
    ¯\_(ツ)_/¯

  • Can you add delegate access to a user's calendar or mailbox folder via powershell?

    Basically I want to know if you can grant a user delegate access to another user's calendar or meeting room using native  powershell commands?
    I know you can do this via method 1, listed below, however when you grant permissions in this way and if a user wants to see who has delegate access to their calendar or inbox by going to delegate access in outlook they will not see user's who have access
    to their calendar or inbox.
    Method 1:
    Add-MailboxFolderPermission -Identity "userA:\Calendar" -User UserB -AccessRights editor
    The above is a nice and simple way of granting userB EDITOR access to UserA's calendar.
    But as stated above as you are using mailboxFolderPermissions and not DelegateAccess, this applies directly to this folder and if userA goes to their delegate access view in Outlook, they will not see that userB has access to their calendar.
    I know that you can use the below commands to see a list of user's who have delegate access to you calendar:
    Get-Mailbox userA | Get-CalendarProcessing | select resourcedelegates
    I am new to powershell and don't know if there is a way of setting delegate access to a user's calendar or inbox/folder via powershell commands, similar to the above.
    Any help with this query would be much appreciated!
    thanks

    Delegate access is simply a combination of folder rights (which you've described) and Send As right, which is conferred by Add-MailboxPermission or Send On Behalf of right, which I'm not sure if you can confer with PowerShell. Set-CalendarProesssing applies
    to resource mailboxes like conference rooms, not to user mailboxes.
    Update: "Send on Behalf of" is conferred this way:
    Set-Mailbox UserMailbox -GrantSendOnBehalfTo UserWhoSends
    Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."

  • Calling a method via invokeMethod (JDI)

    Hi !
    Does anybody know how to invoke a method
    via the invokeMethod method of the Java Debug Interface (JDI).
    This suspends the execution of the program !
    I've read somewhere that the vm must be resumed,
    but I don't see how, as a vm.resume() after the
    invocation is never reached !
    Thanx for any help !
    Alex

    I have the same problem ..Null pointer exception thrown. here is my sample code that I did:
    public void methodExitEvent(MethodExitEvent event)
    ObjectReference obj = objectReference(event);
    if(obj!=null && !event.method().name().equals("<init>"))
    System.out.println(" Leaving the method " + event.method().name() + "() Object " + obj.hashCode());
    List objMethodsList= event.method().declaringType().methodsByName("methodA");
    Method emptyState= (Method)objMethodsList.get(0);
    //ClassType myClass= (ClassType)obj.referenceType();
    //Method emptyState= myClass.concreteMethodByName("methodA","()V");
    try
    Value myValue= obj.invokeMethod(event.thread(), emptyState ,null,ObjectReference.INVOKE_SINGLE_THREADED);
    catch(Exception e)
    e.printStackTrace();
    System.out.println("Error in invoking method "+e.getMessage());
    else if(obj!=null && event.method().name().equals("<init>"))
    System.out.println("Object " + obj.hashCode()+" END its life");
    and here is the trace that i got from the exception thrown:
    java.lang.NullPointerException
    at com.sun.tools.jdi.MirrorImpl.validateMirrorsOrNulls(MirrorImpl.java:8
    2)
    at com.sun.tools.jdi.ObjectReferenceImpl.invokeMethod(ObjectReferenceImp
    l.java:355)
    at EventThread.methodExitEvent(EventThread.java:186)
    at EventThread.handleEvent(EventThread.java:69)
    at EventThread.run(EventThread.java:35)
    Error in invoking method null
    Need help ASAP especially those of you who have created debugger. Im trying to create a tracer and try to invoke the method of the debugee object....

  • Enhancement in method LOGICAL_SYSTEM_GET_NEW class /SAPSRM/CL_PDO_BO_SC

    Hello all, I am working in SRM 7.0 with a classic scenario and I need to create an especial situation when we can create stock material in SRM with this scenario.
    SAP proposed that we can do an enhancement in method LOGICAL_SYSTEM_GET_NEW for class /SAPSRM/CL_PDO_BO_SC.
    We need that when (if cs_item-subtype = /SAPSRM/IF_PDO_OBJ_TYPES_C=>GC_SUBTYPE_I_DP) that corresponds in this case with a direct purchasing or stock material purchasing, then backend logical system must be determined using BBP_DETERMINE_LOGICAL_SYSTEM function.
    But I don´t know what is the variable that I need to change in the function, what variable used the function to determine backend logical system?
    Thanks in advance
    Rosa Rodríguez

    Hello Jozef,
    we have the same problem.
    Can you provide your solution for the problem?
    Thank you in advance.
    Regards,
    Florian

  • [Forum FAQ] How to install and configure Windows Server Essentials Experience role on Windows Server 2012 R2 Standard via PowerShell locally and remotely

    As we all know,
    the Windows Server Essentials Experience role is available in Windows Server 2012 R2 Standard and Windows Server 2012 R2 Datacenter. We can add the Windows Server
    Essentials Experience role in Server Manager or via Windows PowerShell.
    In this article, we introduce the steps to install and configure Windows
    Server Essentials Experience role on Windows Server 2012 R2 Standard via PowerShell locally and remotely. For better analyze, we divide this article into two parts.
    Before installing the Windows Server Essentials Experience Role, please use
    Get-WindowsFeature
    PowerShell cmdlet to ensure the Windows Server Essentials Experience (ServerEssentialsRole) is available. (Figure 1)
    Figure 1.
    Part 1: Install Windows Server Essentials Experience role locally
    Add Windows Server Essentials Experience role
    Run Windows PowerShell as administrator, then type
    Add-WindowsFeature ServerEssentialsRole cmdlet to install Windows Server Essentials Experience role. (Figure 2)
    Figure 2.
    Note: It is necessary to configure Windows Server Essentials Experience (Post-deployment Configuration). Otherwise, you will encounter following issue when opening Dashboard.
    (Figure 3)
    Figure 3.
      2. Configure Windows Server Essentials Experience role
    (1)  In an existing domain environment
    Firstly, please join the Windows Server 2012 R2 Standard computer to the existing domain through the path:
    Control Panel\System\Change Settings\”Change…”\Member of. (Figure 4)
    Figure 4.
    After that, please install Windows Server Essentials Experience role as original description. After installation completed, please use the following command to configure Windows
    Server Essentials:
    Start-WssConfigurationService –Credential <Your Credential>
    Note: The type of
    Your Credential should be as: Domain-Name\Domain-User-Account.
    You must be a member of the Enterprise Admin group and Domain Admin group in Active Directory when using the command above to configure Windows Server Essentials. (Figure 5)
    Figure 5.
    Next, you can type the password for the domain account. (Figure 6)
    Figure 6.
    After setting the credential, please type “Y” to continue to configure Windows Server Essentials. (Figure 7)
    Figure 7.
    By the way, you can use
    Get-WssConfigurationStatus
    PowerShell cmdlet to
    get the status of the configuration of Windows Server Essentials. Specify the
    ShowProgress parameter to view a progress indicator. (Figure 8)
    Figure 8.
    (2) In a non-domain environment
    Open PowerShell (Run as Administrator) on the Windows Server 2012 R2 Standard and type following PowerShell cmdlets: (Figure 9)
    Start-WssConfigurationService -CompanyName "xxx" -DNSName "xxx" -NetBiosName "xxx" -ComputerName "xxx” –NewAdminCredential $cred
    Figure 9.
    After you type the commands above and click Enter, you can create a new administrator credential. (Figure 10)
    After creating the new administrator credential, please type “Y” to continue to configure Windows Server Essentials. (Figure 11)
    After a reboot, all the configurations will be completed and you can open the Windows Server Essentials Dashboard without any errors. (Figure 12)
    Figure 12.
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Part 2: Install and configure Windows Server Essentials Experience role remotely
    In an existing domain environment
    In an existing domain environment, please use following command to provide credential and then add Server Essentials Role: (Figure 13)
    Add-WindowsFeature -Name ServerEssentialsRole
    -ComputerName xxx -Credential DomainName\DomainAccount
    Figure 13.
    After you enter the credential, it will start install Windows Server Essentials role on your computer. (Figure 14)
    Figure 14.
    After the installation completes, it will return the result as below:
    Figure 15.
    Next, please use the
    Enter-PSSession
    cmdlet and provide the correct credential to start an interactive session with a remote computer. You can use the commands below:
    Enter-PSSession –ComputerName
    xxx –Credential DomainName\DomainAccount (Figure 16)
    Figure 16.
    Then, please configure Server Essentials Role via
    Add-WssConfigurationService cmdlet and it also needs to provide correct credential. (Figure 17)
    Figure 17.
    After your credential is accepted, it will update and prepare your server. (Figure 18)
    Figure 18.
    After that, please type “Y” to continue to configure Windows Server Essentials. (Figure 19)
    Figure 19.
    2. In a non-domain environment
    In my test environment, I set up two computers running Windows Server 2012 R2 Standard and use Server1 as a target computer. The IP addresses for the two computers are as
    below:
    Sevrer1: 192.168.1.54
    Server2: 192.168.1.53
    Run
    Enable-PSRemoting –Force on Server1. (Figure 20)
    Figure 20.
    Since there is no existing domain, it is necessary to add the target computer (Server1) to a TrustedHosts list (maintained by WinRM) on Server 2. We can use following command
    to
    add the TrustedHosts entry:
    Set-Item WSMan:\localhost\Client\TrustedHosts IP-Address
    (Figure 21)
    Figure 21.
    Next, we can use
    Enter-PSSession
    cmdlet and provide the correct credential to start an interactive session with the remote computer. (Figure 22)
    Figure 22.
    After that, you can install Windows Server Essentials Experience Role remotely via Add-WindowsFeature ServerEssentialsRole cmdlet. (Figure 23)
    Figure 23.
    From figure 24, we can see that the installation is completed.
    Figure 24.
    Then you can use
    Start-WssConfigurationService cmdlet to configure Essentials Role and follow the steps in the first part (configure Windows Server Essentials Experience in a non-domain environment) as the steps would be the same.
    The figure below shows the status of Windows Server Essentials.
    Figure
    25.
    Finally, we have successfully configured Windows Server Essentials on Server1. (Figure 26)
    Figure 26.
    More information:
    [Forum
    FAQ] Introduce Windows Powershell Remoting
    Windows Server Essentials Setup Cmdlets
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

Maybe you are looking for