Powershell script to Add global condition (of OS Requirement) to ALL application deployment types

Looking for an automated way via Powershell to Add global condition (of OS Requirement) to ALL application deployment types.
We currently have over 300+ Applications in SCCM and looking for an automated way of adding a global condition where OS requirement is equal to Windows 7 instead of the default of Any OS.
a

Hi,
Here is a Adam Meltzer's blog about how to create an Application with a requirement rule pointing to a global condition. You could have a look.
http://blogs.msdn.com/b/ameltzer/archive/2012/10/23/how-to-create-an-application-with-a-requirement-rule-pointing-to-a-global-condition.aspx
Best Regards,
Joyce
We
are trying to better understand customer views on social support experience, so your participation in this
interview project would be greatly appreciated if you have time.
Thanks for helping make community forums a great place.

Similar Messages

  • Powershell script to add multiple domains to a transport rule

    I have a transport rule in Exchange 2013 that I created in the EAC (mail flow>rules).  it is set so *Apply this rule if.. the sender's domain is..  and then I entered a few domains.
    I want to use a powershell script to enter multiple domains into the senderdomainis parameter using the set-transportrule.  I would like to do this from a csv input file.  The file has  header row of domains and then the domains are listed
    under it.  This is also used successfully in a script that does content and sender id filter additions.
    I tried the following:
    $allowed = import-csv c:\temp\allowed.csv
    $Rule=get-transportrule "safe domain List"
    $Senderdomains =$rule.senderdomainis
    foreach($row in $allowed)
    $Senderdomains +=$row.domain
    #Set-Transportrule "Safe Domain List" -senderdomainis $Senderdomains
    It just adds a long line of all the domains mashed together without separation.
    Any ideas would be helpful.
    Thanks.

    This isn't the most elegant solution, but I was able to accomplish it with this script:
    $allowed = import-csv c:\temp\allowed.csv
    $domains=Get-TransportRule "Safe Domain List" | select -ExpandProperty senderdomainis
    foreach ($a in $allowed)
    $domains += $a.domain
    $domainstoadd = $domains | select -Unique
    Set-TransportRule "Safe Domain List" -SenderDomainIs $domainstoadd
    It's key to note that the column in the CSV file has a heading of "Domain". Basically the script pulls the existing array into a variable so you can add values from the CSV to the array. This creates duplicates,
    so the "Select -Unique" is a quick and easy way to eliminate the duplicates.

  • Powershell Script to change the default user Account picture for all users in windows 7 and 8

    Hello,
    Can some sone help me with PS script to change user account pictures of all user account in windows 7 and windows 8 ?
    I will deploy this through MDT TS as Custom TS after OSD.
    Shailendra
    Shailendra Dev

    Hello,
    Can some sone help me with PS script to change user account pictures of all user account in windows 7 and windows 8 ?
    I will deploy this through MDT TS as Custom TS after OSD.
    Shailendra
    Shailendra Dev
    The default user account picture is stored here.
    C:\programdata\Microsoft\User Account Pictures\user.bmp
    It should just be a matter have copying the picture you want to that location and over writing what is there.
    or....
    Computer Configuration\Administrative Templates\Control Panel\User Accounts\Apply the default user logon picture to all users
    You can also configure this by a registry setting;
     [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer]
      UseDefaultTile = 1
    The picture that you configure, will not be loaded until the user account will actually be created on the pc. Meaning the first time a >new< user will log on to a pc, they will have no picture shown at all using their login screen (this is default
    behavior). Same will occur if you enable the policy don't display last user name. However, once they log in the picture will be shown in the start menu, and if they lock their pc the image will also be shown

  • SCCM 2012 use PowerShell to create a GlobalCondition, limiting the Deployment Type of an Application to certain operating systems.

    Title says it all basically.
    In the GUI im able to create a Global Condition (condition type: Expression) where I can add a clause that Limits the deployment type of an application to certain operating Systems (useful for deploying 64-bit apps).
    Is there away to Trigger that Setting using PowerShell? So far I haven't found one.
    Thx in advance...

    I changed my script a little bit and can be found Here. 
    An example to use it is:
    #Get Application named "Test" from the Server "localhost"           
    $app = Get-SCCMApplication "Test" "localhost"
    #A rule will be created from the global condition rule "ForumTest" where the registry value equals to "1"
    $rule1 = Create-SCCMGlobalConditionsRule . "ForumTest" "IsEquals" 1 "Registry"
    #Add the rule to the requirement rule of the deployment type
    $app.DeploymentTypes[0].Requirements.Add($rule1)
    #And save the application
    Save-SCCMApplication $app
    PowerShell, System Center 2012, Windows 8 http://blog.lechar.nl
    Thanks Rob!
    Have unfortunately encountered some problems:
    Get-SCCMApplication does not exist. Changed it to Get-CMApplication
    Create-SCCMGlobalConditionsRule - Cant find any "Create..." cmdlets
    Save-SCCMApplication does not exist
    Get-CMApplication : A positional parameter cannot be found that accepts argument 'TestApp'.
    At H:\sctipt\SetRequirement.ps1:2 char:9
    +  $app = Get-CMApplication "TestApp" "siteServe ...
    +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidArgument: (:) [Get-CMApplication], ParameterBindingException
        + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.ConfigurationManagement.Cmdlets.AppMan.Commands.GetApplicationCommand
    Create-CMGlobalConditionsRule : The term 'Create-CMGlobalConditionsRule' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
    the spelling of the name, or if a path was included, verify that the path is correct and try again.
    At H:\script\SetRequirement.ps1:5 char:11
    +  $rule1 = Create-CMGlobalConditionsRule . "GlobalRuleName" "IsEquals" 1 "Registry"
    +           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (Create-CMGlobalConditionsRule:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException
    Cannot index into a null array.
    At H:\script\SetRequirement.ps1:8 char:2
    +  $app.DeploymentTypes[0].Requirements.Add($rule1)
    +  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
        + FullyQualifiedErrorId : NullArray
    Save-CMApplication : The term 'Save-CMApplication' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the na
    me, or if a path was included, verify that the path is correct and try again.
    At H:\script\SetRequirement.ps1:12 char:1
    + Save-CMApplication $app
    + ~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (Save-CMApplication:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException

  • Using Echo Command in PowerShell Script for Configuration Item

    Hello All,
    Before you tell me to post my PowerShell question to the PowerShell Forum, please know that the PowerShell portion of my task works just fine. It is the SCCM portion of my task that keeps failing, so that is why I am here. To give some background...
    There are two servers in our SCCM test environment. Both the SCCM server and SQL DB server are 2012, patched and updated.
    Test servers in my Device Collection being used for running Baselines and Reports against are 2008R2 and 2012, patched and updated.
    I have created a Configuration Item that checks to see if the FTP Server Role Feature has been installed on a 2008 or 2012 server. To do the check, I am using the following PowerShell script:
    (get-windowsfeature -Name Web-Ftp-Server).Installed
    When I log into my 2008R2 and 2012 test servers, and run this command directly on the server, it will return a "True" if the FTP Server Role Feature is installed on either server, and a "False" if it is not installed. Basically,
    it works as advertised.
    When I setup my Configuration Item and then deploy my Baseline, or run a report against my device collection of test servers, SCCM will return a correct response (True or False) for the 2012 test server, but throws the following error for the 2008R2
    server:
    0x87df00329 application requirement evaluation or detection failed
    Google searches for this have not been very helpful.
    Now, when I created the Configuration Item and referenced PowerShell, the configuration screen has the following note:
    "Specify the script to find and return the value to be assessed for compliance on client devices. Use the echo command to return the script value to Configuration Manager."
    Since I did not include an echo command in my PowerShell script above, I figured that was my problem, so I did the following:
    Logging onto both of my test servers (2008R2 & 2012) I was able to successfully run the following PowerShell commands and get the expected responses of True or False:
    (get-windowsfeature -Name Web-Ftp-Server).Installed | echo
    (get-windowsfeature -Name Web-Ftp-Server).Installed | write-output (http://technet.microsoft.com/en-us/library/hh849921.aspx)
    (get-windowsfeature -Name Web-Ftp-Server).Installed | write-host (http://technet.microsoft.com/en-us/library/ee177031.aspx)
    However, when I use any of these PowerShell commands in my Configuration Item, NEITHER of my test servers returns a response to the SCCM server.
    When I check the report, both servers show as "Unknown" and when I click on the number 2 (as in 2 servers unknown), the following report page (List of unknown assets for a configuration baseline) has absolutely no data/information at all.
    So...I am at a loss.
    SCCM tells me to use an echo command to return a script value to Configuration Manager. The PowerShell scripts above, with the various echo related commands, work just fine on the servers themselves, but they return no information when run via SCCM.
    What am I missing?
    Any help will be appreciated.
    Thanks in advance for your time.

    Sorry for my ignorance, but I don't understand. (I forgot to mention that I am new at both PowerShell and SCCM.)
    After I change the PowerShell script to add the echo/write-output/write-host cmdlet, I open the ConFig Item and "Clear" the PowerShell script and then re-add it. When I do that, it correctly shows the change in the ConFig Item.
    Next I open the Baseline, then open the ConFig Item within the Baseline to make sure the change is reflected there as well, which it is.
    I then deploy the Baseline to my Device Collection. After that, I run a report against the Baseline and Device Collection and it returns the "Unknown" result.
    If I open the PowerShell script and remove the echo/write-output/write-host cmdlet, then go through the rest of the process of updating and reporting, the result it returns changes, showing one server in compliance and the other server out of compliance,
    which leads me to think that all changes have taken correctly.
    Does that sound right? If I manually deploy the Baseline, is that the same as the client retrieving policies from the management point?
    Sorry to be so thick but I'm learning as I go.
    Thanks again for your help.

  • Run a powershell script with domain credentials during task sequence

    I have a powershell script that adds the computer it is run on to a security group.  If I log onto the computer with a domain account it works perfectly.  However, if it is run while logged on as the local admin account it fails with an error message
    that says the domain either doesn't exist or cannot be reached.
    This is a problem because when a computer is being imaged the process runs with the local admin account.  Is there a way to run this script with domain credentials in the task sequence?
    Thanks,
    Andy

    How are you running the Powershell script? If you use a Run Command Line step, you can specify an account to run as. Something like "powershell %scriptroot%\psscript.ps1" where the psscript.ps1 is located in your Scripts folder in your deployment
    share.
    -Nick O.

  • Executing powershell script via task scheduler

    Hello,
    I am trying to execute powershell script via windows task scheduler which will forcefully delete all email in a mailbox, but I am getting the below errors
    Operational Code - 2
    Task Category - Action Completed --- Task Scheduler successfully completed task "\IL98" , instance "{2b193375-cbd2-4986-918d-3cfd4027d6b6}" , action "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" with return code 0.
    Last Run Result - 0X0
    When I am adding additional cmdlets in the script "Set-ExecutionPolicy Unrestricted", I am getting Last Run Result 0X5 rest of the error remains the same.
    Powershell version - 3.0
    Task Scheduler version - 1.0
    If I try to run the script manually via Exchange Powershell the script executes without any errors
    Thanks in Advance,
    Ankush Shah

    I figured out the problem, there wasn't any problem with the script but I had to correct inputs in windows task scheuler
    Below is the resolution:
    Under Actions:
        Program/Script --> ws\System32\WindowsPowerShell\v1.0\powershell.exe
        Add Argument --> -noexit -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto
    ; <filepath>"
    Eariler I was writing the filepath after double quote "
    Also I have selected the option "Run with Highest Privilages" to avoid
    0x5 error

  • Disable Static IP in Windows 8.1 and Windows 7 or Powershell Script to get network "connected to" value

    Hi,
    I´m in a situation where I need to disable static IP option on all Domain machines (workstations). I have found many different forum topics about that but nothing is suitable for me. Let me describe a situation:
    * In our environment every computer have specific IP configured in DHCP (specific MAC = specific IP). Machines Must be configured DHCP enabled!
    * In our environment all developers are local admins in their computers. This can´t be changed as we are IT corporation and this is our policy.
    * As every IP have specific rights in Firewall to access different places then some IT guys are quite smart to change their IP to static IP that have more access then they should have.
    This last thing is my main problem! We have working PKI and NPS in both WLAN and LAN so only domain and certified computers can have access to our local network. My mission is to prevent local admins to change IP addressess by themselves but I can´t find
    a good solution for doing that. I have tought about Powershell script that is published by SCCM or GPO to all workstations and script idea is to find network card that is "connected to" our "domain.com" network. If this is true then automatically
    DHCP will be enabled for that interface (Set-NetIPInterface -Dhcp Enabled). I know that here is an open window for some moment when script will be ran again or GPO policy will be refreshed but it´s better then nothing. In this script I have one problem - I
    can´t find a solution about how to find network interface that is connected to our "domain.com"? It seems that there is no easy way to do that. 
    Is there any other and better solution to accomplished this situation. Any good ideas will be appreciated.
    Best Regards,
    Taavi

    Hi,
    the real answer is the one you don't want to hear: don't make your users local admninistrators.
    Local administrators will always be able to get araound any security measurement you put in place. For gpo's for example, they can identify the involved registry key, configure it to their desired value and
    remove privileges for everyone but themselves to write the key. Upcoming 'gpupdate' will not be able to write the values...
    For your script, I would recommend to just configure all adapters to dhcp on the client computers. After all the location detection depends on the network Location Awareness service. If your users disable that one (an rermove the appropriate privileges from
    registry ;) ) your script would again be useless.
    That being said, as you post to the security forums my answer is focussed on the security off your solution. if you need assistance in creating this script, I would advice to post back in the Scripting guys forums (and leave out the why as you will otherwise
    agin be pointed on the flawed security ;) )
    I think get-connectionprofile might already be helpull on 8.1
    MCP/MCSA/MCTS/MCITP

  • Global Condition and IP Address

    Hi, is there a way to use WQL Global Condition to get an IP Address or at least evaluate a part of it?
    I tried to use that query:
    And I wasn't able to get any result. I tried Contains, begin with and my deployment was all the time not applicable.
    Is there any way to do it?
    I am trying to deploy an app that require a UNC path. There is no DFSR in place and the guy here do not want to use it.
    So I have an XML file that will point on a specific UNC path for each location but I need a way to make it happen in my deployment.
    There is no AD Sites sets as well so I was trying to get something from a Global Condition.
    Any other idea is welcome.
    Mathieu

    Yes sorry I forgot that one, I am using the Application deployment type, which will launch the correct deployment type based on the requirement.
    I was in the idea to use that Application for my unknown computers also (in my task sequence). This is why that part was pretty helpful.

  • Global Conditions - Powershell Script - Script is not signed (Error: 87D00327; Source: CCM)

    I failed to use any Powershell script in Global Conditions with error 87D00327. The script is signed and tested without problem. Setting execution policy doesn't change the result at all.
    Error message as below:
    In-line script returned error output: File C:\Windows\CCM\SystemTemp\e7001c04-3966-46a7-9622-26c36d9c45de.ps1 cannot
    be loaded. The file C:\Windows\CCM\SystemTemp\e7001c04-3966-46a7-9622-26c36d9c4
    5de.ps1 is not digitally signed. The script will not execute on the system. Ple
    ase see "get-help about_signing" for more details..
    At line:1 char:2
    + & <<<< 'C:\Windows\CCM\SystemTemp\e7001c04-3966-46a7-9622-26c36d9c45de.ps1'
    + CategoryInfo : NotSpecified: (:) [], PSSecurityException
    + FullyQualifiedErrorId : RuntimeException
    ScriptProvider 6/23/2014 1:45:06 PM 2516 (0x09D4)
    ScriptProvider::CreateInstanceEnumAsync - Script Execution Returned :1, Error Message:File C:\Windows\CCM\SystemTemp\e7001c04-3966-46a7-9622-26c36d9c45de.ps1 cannot
    be loaded. The file C:\Windows\CCM\SystemTemp\e7001c04-3966-46a7-9622-26c36d9c4
    5de.ps1 is not digitally signed. The script will not execute on the system. Ple
    ase see "get-help about_signing" for more details..
    At line:1 char:2
    + & <<<< 'C:\Windows\CCM\SystemTemp\e7001c04-3966-46a7-9622-26c36d9c45de.ps1'
    + CategoryInfo : NotSpecified: (:) [], PSSecurityException
    + FullyQualifiedErrorId : RuntimeException
    ScriptProvider 6/23/2014 1:45:06 PM 2516 (0x09D4)
    Failed in discovering instance.
    Script is not signed (Error: 87D00327; Source: CCM) ScriptProvider 6/23/2014 1:45:06 PM 2516 (0x09D4)
    Failed to do HandleExecQueryAsync().
    Script is not signed (Error: 87D00327; Source: CCM) ScriptProvider 6/23/2014 1:45:06 PM 2516 (0x09D4)
    Failed to process CScriptProvider::GExecQueryAsync.
    Script is not signed (Error: 87D00327; Source: CCM) ScriptProvider 6/23/2014 1:45:06 PM 2516 (0x09D4)
    I can't figure out a way to capture the temp script file mentioned in the error message so I can't verify the script locally.
    Any help will be appreciated.
    Sean
    Regards, Sean

    Hi, Sean.
    There was a product issue with signed PowerShell detection method scripts that has been fixed in R2 CU2. I just noticed it's not mentioned in the KB article for CU2. I'm not sure what happened here but I'll have somebody look into this.
    Anyway, there's a couple of caveats to consider regarding this fix in your scenario. Firstly if you're creating a PowerShell script detection method you must not copy/paste the script text -- you need to "Open" it. Secondly, if you have any previously created
    PowerShell script detection methods with signed scripts, you will need to re-add the detection script (again using "Open"). Finally, you must use an administrator console that's been updated to CU2 and a client that's been updated to CU2 for this fix to be
    effective.
    I hope this helps resolve the issue for you.
    Check out my Configuration Manager blog at http://aka.ms/ameltzer

  • Update a filed value with powershell script with ordery by and where condition

    Hi
    I have below powershell script to update list columns but  how i update a field value with ordery by a column and where condition
    below is the part of my script
    $list = $web.Lists[$listName]
    $items = $list.items
    $internal_counter = 1
    #Go through all items
    foreach($item in $items)
    if($item["CourtNO"] -eq $null)
    #if($item["CourtNo"] -eq '1')
    $item["CaseNo"] = $internal_counter
    #how to add a column ordery by Title
    # and where Title field value from 1 to 10
    $internal_counter++
    adil

    Hi,
    You mean that you only need to update all items with Title field value in range 1..10 and order by them before run the loop statement update?
    If so, use CAML query to get the items only match the condition.
    #Build Query
    $spQuery = New-Object Microsoft.SharePoint.SPQuery
    $query = '<Where><And><Gte><FieldRef Name="Title" /><Value Type="Text">0</Value></Gte><Lte><FieldRef Name="Title" /><Value Type="Text">10</Value></Lte></And></Where><OrderBy><FieldRef
    Name="Title"/></OrderBy>'
    $spQuery.Query = $query
    $spQuery.RowLimit = $list.ItemCount
    $items = $list.GetItems($spQuery)
    Hope this help!
    /Hai
    Visit my blog: My Blog | Visit my forum:
    SharePoint Community for Vietnamese |
    Bamboo Solution Corporation

  • Powershell script to Scan Active Directory Attributes for Country and Department ,Then add to Sales Group then add to Distribution list based on Region

    Hey Scripting Guys,
    I have been in and out of Powershell last few years, not that great at it tbh !!! I'm looking for advice on how I can as in Title, Create a Powershell script to Scan Active Directory Attributes for Country and Department ,Then add to Group then add to Distribution
    list based on Region/Country
    I was thinking along the lines of get-aduser -LDAPFilter "(department=SALES France) and adding a where clause for country.
    Any help would be great.
    Dec

    So I have tried a few variations but get errors on both 
    get-aduser -LDAPFilter "(&(department=SALES)(c=us))" | Add-ADPrincipalGroupMembership -MemberOf "testgroup"
    get-aduser -LDAPFilter "(&(department=SALES)(c=fr))" | Add-ADGroupMember -identity "testgroup"
    Add-ADPrincipalGroupMembership : Object reference not set to an instance of an
    object.
    At line:1 char:86
    + get-aduser -LDAPFilter "(&(department=SALES)(c=fr))" | Add-ADPrincipalGroupMe
    mbership <<<< -MemberOf "testgroup"
    + CategoryInfo : NotSpecified: (:) [Add-ADPrincipalGroupMembershi
    p], NullReferenceException
    + FullyQualifiedErrorId : Object reference not set to an instance of an ob
    ject.,Microsoft.ActiveDirectory.Management.Commands.AddADPrincipalGroupMem
    bership

  • Running PowerShell Script to automate the installation of IIS feature - Add-WindowsFeature error, help please

    I'm just learning PS scripting and Chef Programming, so I'm sure I'm missing something simple. I'm trying to run a recipe that is using PS as the interpreter. I've ensured I'm running PS in 64 bit with admin privileges, and have Imported the ServerManager
    module. I even added a line to my script to have it run that first, but am still receiving an error in my script. I'm running this on a VM of Server 2008R2
    Script:
    powershell_script 'Install IIS' do
      code "Import-Module ServerManager -passthru"
      code "Add-WindowsFeature Web-Server"
      guard_interpreter :powershell_script
      not_if "(Get-WindowsFeature -Name Web-Server).Installed"
    end
    Error:
    PS C:\Users\Administrator\chef-repo> chef-apply webserver.rb
    Recipe: (chef-apply cookbook)::(chef-apply recipe)
      * powershell_script[Install IIS] action run
        ================================================================================
        Error executing action `run` on resource 'powershell_script[Install IIS]'
        ================================================================================
        Mixlib::ShellOut::ShellCommandFailed
        Expected process to exit with [0], but received '1'
        ---- Begin output of "powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy RemoteSigned -InputFormat
    None -File "C:/Users/ADMINI~1/AppData/Local/Temp/chef-script20141224-432-mxaa9u.ps1" ----
        STDOUT:
        STDERR: The term 'Add-WindowsFeature' is not recognized as the name of a cmdlet, function, script file, or operable
    program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
        ---- End output of "powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy RemoteSigned -InputFormat No
    ne -File "C:/Users/ADMINI~1/AppData/Local/Temp/chef-script20141224-432-mxaa9u.ps1" ----
        Ran "powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy RemoteSigned -InputFormat None -File "C:/Us
    ers/ADMINI~1/AppData/Local/Temp/chef-script20141224-432-mxaa9u.ps1" returned 1
        Resource Declaration:
        # In webserver.rb
          1: powershell_script 'Install IIS' do
          2:   code "Import-Module ServerManager -passthru"
          3:   code "Add-WindowsFeature Web-Server"
          4:   guard_interpreter :powershell_script
          5:   not_if "(Get-WindowsFeature -Name Web-Server).Installed"
          6: end
        Compiled Resource:
        # Declared in webserver.rb:1:in `run_chef_recipe'
        powershell_script("Install IIS") do
          action "run"
          retries 0
          retry_delay 2
          guard_interpreter :powershell_script
          command "\"powershell.exe\" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy RemoteSigned -InputFormat None -Fi
    le \"C:/Users/ADMINI~1/AppData/Local/Temp/chef-script20141224-432-mxaa9u.ps1\""
          backup 5
          returns 0
          code "Add-WindowsFeature Web-Server"
          interpreter "powershell.exe"
          cookbook_name "(chef-apply cookbook)"
          recipe_name "(chef-apply recipe)"
          not_if "(Get-WindowsFeature -Name Web-Server).Installed"
        end
    [2014-12-24T10:29:56-08:00] FATAL: Stacktrace dumped to C:/chef/cache/chef-stacktrace.out
    [2014-12-24T10:29:56-08:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: powershell_script[Install IIS] ((chef-apply coo
    kbook)::(chef-apply recipe) line 1) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0
    ], but received '1'
    ---- Begin output of "powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy RemoteSigned -InputFormat None
     -File "C:/Users/ADMINI~1/AppData/Local/Temp/chef-script20141224-432-mxaa9u.ps1" ----
    STDOUT:
    STDERR: The term 'Add-WindowsFeature' is not recognized as the name of a cmdlet, function, script file, or operable prog
    ram. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    ---- End output of "powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy RemoteSigned -InputFormat None -
    File "C:/Users/ADMINI~1/AppData/Local/Temp/chef-script20141224-432-mxaa9u.ps1" ----
    Ran "powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy RemoteSigned -InputFormat None -File "C:/Users/
    ADMINI~1/AppData/Local/Temp/chef-script20141224-432-mxaa9u.ps1" returned 1

    Hi There,
    We have a application named Microsoft SCOM. That as well requires ISS to be installed. I tried this long back and it worked in powershell. Below is the powershell script i used to install IIS and some specific features from it. Hope it helps in altering
    it and making one of your own script.
    1.  Launch the PowerShell command
    prompt
     Run this command
    Import-Module ServerManager
    3. Press Enter
    4. Run this
    command
    Add-WindowsFeature NET-Framework-Core,Web-Metabase,Web-WMI,Web-Static-Content,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-Asp-Net,Web-Net-Ext,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Filtering,Web-Windows-Auth,
    Web-Mgmt-Console –restart
    Gautam.75801

  • How to add powershell script code in form application in C#

    Hi,
    i am creating a form application in C# and have powershell code which will create remote session on remote machine and execute few commands like set execution policy copy some share files install that files etc.
    I have to add this powershell script into form application in C#.
    Can some one please give me some example how to add the whole script which i have into C# code form application. Thanks in advance
    Thanks,

    Hi
    So the left is Run PowerShell Commands on Remote machine? Am I right ?
    Here  is a article talking about running  powershell commands on Remote Computers.
    http://www.howtogeek.com/117192/how-to-run-powershell-commands-on-remote-computers/
    About how to write in C#, please follow
    Joel Engineer's reply, using  process.Start() method  to start
    PowerShell.exe and Run PowerShell Commands to connect remote machine.
    Best regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • I dont have any Add-ons with my FireFox. After upgrade to the latest version 26.0 I'm keep getting Script error "chrome://global/content/binding/popup.xml:580"

    Quite frequently I'm keep getting the error like "Script is not responding....I dont have any Add-ons with my FireFox. After upgrade to the latest version 26.0 I'm keep getting Script error "chrome://global/content/binding/popup.xml:580" Stop or Continue Script.
    Currently I don't have any Add-Ons installed in my FireFox, so I can suspect any Add-ons.
    I'm facing this issue only after the upgrade to 26.0 recently.

    Ifound this article:
    https://support.mozilla.org/pt-BR/questions/746499
    in this article the problem is similar not the same, but sdmitch16 had a intersting idea disable the chrome options
    and i search more in the internet i also found this:
    https://support.mozilla.org/pt-BR/questions/760704

Maybe you are looking for

  • Assign a value from dropdownlist to input field value on BSP page

    Hi, I'm new to SAP and ABAP. We have a CRM project in which I have to maintain BSP pages. Now, coming to my problem: I have a input field with value = "//BTAdminH/HeaderInfo" This field is normally maintainable. The required function is now to set th

  • How do i update my software on my ipod

    how do i update the software on my ipod touch (2nd gen.) from 4.2.1 to the latest version

  • Using FileIOInteractionSpec Class For Moving File using File Adapter

    Hi All, I am tring to use FileIOInteractionSpec class to move a file from one location to another. The problem is that I am not able to override its properties from BPEL, here is how the FileAdapter.jca file looks like which moves the file from one l

  • Change font size in write to OLED for lm3s8962

    I'm would like to increase the font size that is displayed on the OLED screen with the lm3s8962. I am aware of the write to string vi. This subvi calls a c function, which I assume contains within it the stellarisware c code for writing a string. I'v

  • Sony HDR-SR1 AVCHD

    Does FCE or FCE support Sony HDR-SR1 AVCHD with USB 2.0? I have bought this top camera and now I want to edit it with FCE/FCP and burn this on a blue ray disc with AVCHD codes. Does apple support this camera and AVCHD codes?