Write-Progress in PowerShell script for installing Missing Updates

Hi, I had a previous question here
https://social.technet.microsoft.com/Forums/windowsserver/en-US/88931488-3b2c-4c08-9ad3-6651ba9bbcef/action?threadDisplayName=progress-indicator-for-installing-missing-sccm-2012-r2-updates
But that method is not working as expected.  The progress bar displays then continues to increment past 100 throwing an error each time.
I'm thinking I could use a foreach loop for the missing updates but I'm just lost when it comes to Powershell syntax.
For example:
# Get the number of missing updates
[System.Management.ManagementObject[]] $CMMissingUpdates = @(GWMI -ComputerName $server -query "SELECT * FROM CCM_SoftwareUpdate WHERE ComplianceState = '0'" -namespace "ROOT\ccm\ClientSDK") #End Get update count.
$result.UpdateCountBefore = "The number of missing updates is $($CMMissingUpdates.count)"
#Install missing updates.
#Begin example code, not tested.
Foreach ($update in $CMMissingUpdates)
$i++
If ($CMMissingUpdates.count) {
$CMInstallMissingUpdates = (GWMI -ComputerName $server -Namespace "root\ccm\clientsdk" -Class "CCM_SoftwareUpdatesManager" -List).InstallUpdates($CMMissingUpdates)
Do {
Start-Sleep -Seconds 15
[array]$CMInstallPendingUpdates = @(GWMI -ComputerName $server -query "SELECT * FROM CCM_SoftwareUpdate WHERE EvaluationState = 6 or EvaluationState = 7" -namespace "ROOT\ccm\ClientSDK")
#end my example code.
#The code below is working to install updates but Write-Progress isn't.
If ($CMMissingUpdates.count) {
#$result.UpdateCountBefore = "The number of missing updates is $($CMMissingUpdates.count)"
$CMInstallMissingUpdates = (GWMI -ComputerName $server -Namespace "root\ccm\clientsdk" -Class "CCM_SoftwareUpdatesManager" -List).InstallUpdates($CMMissingUpdates)
#Set the missing updates to variable for progress indicator.
$updates = $CMMissingUpdates.Count
$Increment = 100 / $updates
$Percent = 0
Do {
Start-Sleep -Seconds 15
[array]$CMInstallPendingUpdates = @(GWMI -ComputerName $server -query "SELECT * FROM CCM_SoftwareUpdate WHERE EvaluationState = 6 or EvaluationState = 7" -namespace "ROOT\ccm\ClientSDK")
#Not 100% sure $result.UpdateCountBefore is needed below.
$result.UpdateCountBefore = "The number of pending updates for installation is: $($CMInstallPendingUpdates.count)"
Write-Progress -Activity "Updates are installing..." -PercentComplete $Percent -Status "Working..."
$Percent = $Percent + $Increment
} While (($CMInstallPendingUpdates.count -ne 0) -and ((New-TimeSpan -Start $StartTime -End $(Get-Date)) -lt "00:45:00"))
Write-Progress -Activity "Updates Installed" -Status "Done" -Completed
} ELSE {
$result.UpdateCountAfter = "There are no missing updates."}
$result

The increment should be 100  / (max number of items)
That will not exceed 100 through (max number of items ) iterations in a loop
Mathematically that can be written as 
100 / (Max Number of items) * (max number of items ) iterations in a loop
= 100 * ( (Max Number of Item) / (Number Iterations in a loop) )
= 100 * 1 = 100
The (max number of items) and (Number of Iterations in a loop ) need to be based on the same number.
In the script, it is not based on the same number.
The maximum number of items is $CMMissingUpdates.Count
The number of iterations in the loop  is based on the condition 
($CMInstallPendingUpdates.count -ne 0)
Which causes the iterations of the loop to exceed $CMMissingUpdates.Count
Assuming the $CMInstallPendingUpdates.count is going down (is decremented) through the loop, then
$Increment = 100 /
$CMInstallPendingUpdates.count

Similar Messages

  • Progress indicator for installing missing SCCM 2012 R2 updates

    Hi Everyone!  I've put together a simple powershell script to install missing SCCM updates and it works well but doesn't output anything to the console when its running.
    How could I include a write-progress indicator during the While loop is running?
    I'm thinking I could insert Write-Progress for the While (($CMInstallPendingUpdates.Count -ne 0) but I'm just not too familiar with the syntax required.  -Thanks!
    # Get the number of missing updates
    [System.Management.ManagementObject[]] $CMMissingUpdates = @(GWMI -ComputerName $server -query "SELECT * FROM CCM_SoftwareUpdate WHERE ComplianceState = '0'" -namespace "ROOT\ccm\ClientSDK") #End Get update count.
    $result.UpdateCountBefore = "The number of missing updates is $($CMMissingUpdates.count)"
    #Install missing updates.
    If ($CMMissingUpdates.count) {
    $result.UpdateCountBefore = "The number of missing updates is $($CMMissingUpdates.count)"
    $CMInstallMissingUpdates = (GWMI -ComputerName $server -Namespace "root\ccm\clientsdk" -Class "CCM_SoftwareUpdatesManager" -List).InstallUpdates($CMMissingUpdates)
    Do {
    Start-Sleep -Seconds 15
    [array]$CMInstallPendingUpdates = @(GWMI -ComputerName $server -query "SELECT * FROM CCM_SoftwareUpdate WHERE EvaluationState = 6 or EvaluationState = 7" -namespace "ROOT\ccm\ClientSDK")
    #Not 100% sure $result.UpdateCountBefore is needed below.
    $result.UpdateCountBefore = "The number of pending updates for installation is: $($CMInstallPendingUpdates.count)"
    } While (($CMInstallPendingUpdates.count -ne 0) -and ((New-TimeSpan -Start $StartTime -End $(Get-Date)) -lt "00:45:00"))
    } ELSE {
    $result.UpdateCountAfter = "There are no missing updates."}

    # Get the number of missing updates
    [System.Management.ManagementObject[]] $CMMissingUpdates = @(GWMI -ComputerName $server -query "SELECT * FROM CCM_SoftwareUpdate WHERE ComplianceState = '0'" -namespace "ROOT\ccm\ClientSDK") #End Get update count.
    $result.UpdateCountBefore = "The number of missing updates is $($CMMissingUpdates.count)"
    #Install missing updates.
    If ($CMMissingUpdates.count) {
    $result.UpdateCountBefore = "The number of missing updates is $($CMMissingUpdates.count)"
    $CMInstallMissingUpdates = (GWMI -ComputerName $server -Namespace "root\ccm\clientsdk" -Class "CCM_SoftwareUpdatesManager" -List).InstallUpdates($CMMissingUpdates)
    $Increment = 100 / $CMInstallMissingUpdate.Count $Percent = 0 Do {
    Start-Sleep -Seconds 15
    [array]$CMInstallPendingUpdates = @(GWMI -ComputerName $server -query "SELECT * FROM CCM_SoftwareUpdate WHERE EvaluationState = 6 or EvaluationState = 7" -namespace "ROOT\ccm\ClientSDK")
    #Not 100% sure $result.UpdateCountBefore is needed below.
    $result.UpdateCountBefore = "The number of pending updates for installation is: $($CMInstallPendingUpdates.count)"       Write-Progress -Activity "Installing updates" -PercentComplete $Percent -Status "Working ..."
    $Percent = $Percent + $Increment
    } While (($CMInstallPendingUpdates.count -ne 0) -and ((New-TimeSpan -Start $StartTime -End $(Get-Date)) -lt "00:45:00")) Write-Progress -Activity "Updates installed" -Status "Done" -Completed} ELSE {
    $result.UpdateCountAfter = "There are no missing updates."}

  • Executing a powershell script for checking duplicate users while creating a AD user throug ADUC console.

    Hi,
    I have a text file in which some SamAccountNames are present.I need to check the file while creating a new users through ADUC console.If a username that is going to create through ADUC console is present in the file, then it should prompt a message
    that the user is already present in the text file.
    Is there any possibility of contacting the powershell script from the ADUC console.If so, then while creating a new user through ADUC console, what is the proceedure for executing that powershell script.
    please provide me the approriate solutions.
    Thanks
    Prasanthi k

    Run the below Powershell Script for users are exist or not in AD. Later you can create the users.
    #Find Users exist in AD or Not?
    #Biswajit Biswas
    $users = get-content c:\users.txt
    foreach ($user in $users) {
    $User = Get-ADUser -Filter {(samaccountname -eq $user)}
    If ($user -eq $Null) {"User does not exist in AD ($user)" }
    Else {"User found in AD ($user)"}
    Active Directory Users attributes-Powershell
    http://gallery.technet.microsoft.com/scriptcenter/Getting-Users-ALL-7417b71d
    Regards~Biswajit
    Disclaimer: This posting is provided & with no warranties or guarantees and confers no rights.
    MCP 2003,MCSA 2003, MCSA:M 2003, CCNA, MCTS, Enterprise Admin
    MY BLOG
    Domain Controllers inventory-Quest Powershell
    Generate Report for Bulk Servers-LastBootUpTime,SerialNumber,InstallDate
    Generate a Report for installed Hotfix for Bulk Servers

  • Powershell script for security groups and users for multiple share folders

    Hi scripting team,
    I need your help with powershell script for the below queries 
    1. List out the security groups for more than one server share path and output it to a file ( csv ) 
    For eg.
    If the are are two share paths 
    \\servername\foldermain\folder1
    \\servername\foldermain\folder2
    So I needs the list of security groups for each share path
    And the output needs to be under each any every path.
    2. Grab the users belongs to main security groups and it nested groups for more than one security group and listed the users under each and every group. No need to display nested groups. Just users belongs to main group and users under nested.
    Your teams help is much appreciated 
    Thank you.
    Thilochana kumararatne

    Hi Braham,
    Thanks for your quick reply.
    Are we able to do this on two stage method
    1. grab the security groups from the share paths
    if can grab the share path from a separate txt file than copying it to the <your path> location
    so i can modify the txt file
    once run the script
    if can the output like below to a CSV file
    \\servername\foldermain\folder1group 1group 2group 3\\servername\foldermain\folder2group 1group 2group 3then i know which groups belongs to which share paththen i can remove the duplicate groups and keep the common groups to grab the users belongs to itso with the second script same as the first copy the security groups to a txt file and the out put as below.what I needs is the users full name and the samaccount name ( user id )group 1user1user2user3
    group 2user1user2user3looking forward your help on thisThank you.Thilo

  • Not able to push batch script for installing IIS all features using SCCM 2012 task sequence

    Hey Guys, I am working for this from a long time but not able to make it work, I am using following batch script for installing IIS  using SCCM 2012 task sequence:
    Dism.exe /online /Enable-Feature /FeatureName:IIS-WebServerRole /FeatureName:IIS-WebServerRole /FeatureName:IIS-WebServer /FeatureName:IIS-ApplicationDevelopment /FeatureName:IIS-Security /FeatureName:IIS RequestFiltering /FeatureName:IIS-NetFxExtensibility
    /FeatureName:WAS-WindowsActivationService /FeatureName:WAS-ProcessModel /FeatureName:WAS-NetFxEnvironment /FeatureName:WAS-ConfigurationAPI /FeatureName:NetFx3 /FeatureName:WCF-HTTP-Activation /FeatureName:WCF-NonHTTP-Activation /FeatureName:IIS-WebServerManagementTools
    /FeatureName:IIS-ManagementConsole /FeatureName:IIS-ManagementScriptingTools  /FeatureName:IISIIS6ManagementCompatibility /FeatureName:IIS-ManagementService /FeatureName:IIS-Metabase /FeatureName:IIS-WMICompatibility
    When I run this script as admin by right click on it and select "run as a administrator" the script works fine but when I pushed the script as a software package or a step in OSD task sequence, nothing happens. I also tried
    run command line option but no luck. Please help me with this.
    Thanks,
    VST

    1. When I used "run command line" option I found following errors in smsts.log:
    Remediation failed. Code 8027000C TSManager 1/2/2014 2:32:12 PM 2720 (0x0AA0)
    Remediation failed with error code 8027000C TSManager 1/2/2014 2:32:12 PM 2720 (0x0AA0)
    Remediation failed. Code 8027000C TSManager 1/2/2014 2:34:16 PM 2092 (0x082C)
    Remediation failed with error code 8027000C TSManager 1/2/2014 2:34:16 PM 2092 (0x082C)
    Failed to run the action: Run Command Line.
    Unknown error (Error: 800F080C; Source: Unknown) TSManager 1/2/2014 2:34:32 PM 2092 (0x082C)
    Failed to delete directory 'C:\_SMSTaskSequence' TSManager 1/2/2014 2:34:33 PM 2092 (0x082C)
    SetNamedSecurityInfo() failed. TSManager 1/2/2014 2:34:33 PM 2092 (0x082C)
    SetObjectOwner() failed. 0x80070005. TSManager 1/2/2014 2:34:33 PM 2092 (0x082C)
    RemoveFile() failed for C:\_SMSTaskSequence\TSEnv.dat. 0x80070005. TSManager 1/2/2014 2:34:33 PM 2092 (0x082C)
    RemoveDirectoryW failed (0x80070091) for C:\_SMSTaskSequence TSManager 1/2/2014 2:34:33 PM 2092 (0x082C)
    Failed to delete registry value HKLM\Software\Microsoft\SMS\Task Sequence\Package. Error code 0x80070002 TSManager 1/2/2014 2:34:33 PM 2092 (0x082C)
    RegQueryValueExW failed for Software\Microsoft\SMS\Task Sequence, SMSTSEndProgram TSManager 1/2/2014 2:34:34 PM 2092 (0x082C)
    GetTsRegValue() failed. 0x80070002. TSManager 1/2/2014 2:34:34 PM 2092 (0x082C)
    ReleaseRequest failed with error code 0x80004005 TSManager 1/2/2014 2:34:34 PM 2092 (0x082C)
    RegQueryValueExW failed for Software\Microsoft\SMS\Task Sequence, SMSTSEndProgram OSDSetupHook 1/2/2014 2:34:35 PM 360 (0x0168)
    GetTsRegValue() failed. 0x80070002. OSDSetupHook 1/2/2014 2:34:35 PM 360 (0x0168)
    2. We are not using MDT in our environment so I ant use add features and roles option.
    3. The script is running fine when we run it manually.

  • Cranpkg - script for installing R libraries

    Hi everyone,
    I have created a script for installing R libraries using pacman.  You can download it at http://allan.mcrae.googlepages.com/cranpkg (currently v0.3.0).
    For example, the "genetics" library is installed using
    > cranpkg -i genetics
    CRANPKG v0.2
    Copyright (C) 2007 Allan McRae
    Examining R installation...
    Installing package genetics...
    Downloading package information...
    Version: 1.3.0
    Dependancies: combinat gdata gtools MASS mvtnorm
    Resolving dependancies...
    Installing combinat...
    Installing gdata...
    Installing mvtnorm...
    Downloading package source...
    Building package...
    Installing package...
    Done
    > pacman -Qs cran
    local/cran-combinat 0.0.6-1
    R library - combinat. Built with cranpkg
    local/cran-gdata 2.3.1-1
    R library - gdata. Built with cranpkg
    local/cran-genetics 1.3.0-1
    R library - genetics. Built with cranpkg
    local/cran-gtools 2.4.0-1
    R library - gtools. Built with cranpkg
    local/cran-mvtnorm 0.8.1-1
    R library - mvtnorm. Built with cranpkg
    This should be fairly robust against failures and leave log files in /tmp/cranpkg if anything fails.  Please let me know if you run into trouble with this.
    There a a few variables that you may need to modify at the top of the script.  For example, the mirror you wish to download from.
    Wget is used by default for the downloading and package installation is done with a "sudo pacman" command.
    Any problems/success please let me know.
    Last edited by Allan (2007-12-31 04:51:27)

    Here is some information on cranpkg status at v0.2:
    Installs and loads fine in R:
    adegenet, allelic, ape, bayesSurv, classifly, coda, combinat, e1071, gdata, gee, genetics, glpk, gstat, gtools, HardyWeinberg, kinship, mcmc, mvtnorm, nortest, qtl, reshape, RGtk2, smoothSurv, sp, tree.
    Installs but fails to load in R:
    graph, rggobi
    Thats greater than 90% success rate...  The packages that fail to load have no files in them (pacman -Ql <pkg> returns nothing).
    Update:  graph requires R>=2.6.0 (latest) which hasn't made it to Arch yet.  rggobi require external software called ggobi so fails.  These errors are caught in v0.2.1.
    Last edited by Allan (2007-10-20 15:13:57)

  • I already have flashplayer on my mac. I have been using online video tutorials for learning, but suddenly all my YouTube vodeos say "plug-in blocked". I follow the instructions for installing or updating, but nothing has helped. I have looked everywhere i

    I already have flashplayer on my mac. I have been using online video tutorials for learning, but suddenly all my YouTube vodeos say "plug-in blocked". I follow the instructions for installing or updating, but nothing has helped. I have looked everywhere in Safari help with no success. How can I restore this plug-in, PLEASE?
    Austin Moore
    Knoxville, Tennessee

    I already have flashplayer on my mac. I have been using online video tutorials for learning, but suddenly all my YouTube vodeos say "plug-in blocked". I follow the instructions for installing or updating, but nothing has helped. I have looked everywhere in Safari help with no success. How can I restore this plug-in, PLEASE?
    Austin Moore
    Knoxville, Tennessee

  • 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.

  • PowerShell Script for Setting the Welcome Page View of a document set

    Hi,
    We are using document set in the document library and we have created the separate view in the document set and it will show only particular metadata columns. We need to change from default view to another view. For this, we need to write the power shell
    script and update the document set welcome page view link in the document set template. Please let me know how we can get this.
    Thanks,
    Mylsamy

    Hey Mylsamy,
    welcome page view is stored in $contenttype.XmlDocuments. Here is how you can change the view using powershell:
    $web = Get-SPWeb "WEBURL"
    $list = $web.Lists["LISTNAME"]
    $contenttype = $list.ContentTypes["CONTENTYPENAME"]
    $viewid = $list.Views["VIEWNAME"].Id
    $xmldocs = $contenttype.XmlDocuments
    foreach($xmldoc in $xmldocs)
    if($xmldoc.Contains("WelcomePageView"))
    Write-Host "XML contains WPV"
    $newview = [XML] @"
    <wpv:WelcomePageView xmlns:wpv="http://schemas.microsoft.com/office/documentsets/welcomepageview" ViewId="$viewid" />
    $xmldocs.Delete("http://schemas.microsoft.com/office/documentsets/welcomepageview")
    $xmldocs.Add($newview)
    break;
    $contenttype.Update($updateChildren, $false)
    Write-Host "Welcome Page View updated at " $list.Title
    Regards,
    Alexander 

  • Write Progress through Whole Script (instead of Timer or through per function)

    Hello Team,
    Is it possible to use the write-progress to begin a the top of a script and run through each function of the script (instead of a timer or per function) and at the end of the script complete?
    For example, here I use a timer:
    for ($i =1;$i = le 100; $i++)
    function sWriteLogInformation
    out-file
    -FilePath $strLog
    -Input Object
    -Append: $true
    -Confirm:$false
    -encoding "Unicode"
    Write-Host -Object $strText
    Get-Process $ProcessName -ErrorAction SilentlyContinue
    If (-not $?)
    strText = "Application is not running."
    Write-Host $strText
    Else
    Stop-Process -processname $processName
    write-Host "Application Closed"
    Write Progress -Activity "Please wait..$strText" -status "$i% Complete" -percentComplete $i;
    start-sleep milliseconds 50
    But I would rather it go through each of the steps/function in the script and close when finished.
    Any input appreciated.
    Thanks!

    Two suggestions:  
    Move the function outside of the for loop, there's no reason to define the same function 100 times.  It may not be a problem with this script, but with a large data set it will affect performance.  And it's just plain bad practice.
    Move the Write-Progress command to follow the initial for statement so it is displayed immediately instead of after processing the first item.
    As jrv suggested, you can have multiple write-progress statements that provide more information for each step, perhaps like this:
    function sWriteLogInformation ($strText) {
    out-file
    -FilePath $strLog
    -Input $strText
    -Append: $true
    -Confirm:$false
    -encoding "Unicode"
    Write-Host -Object $strText
    for ($i =1;$i = le 100; $i++) {
    Write Progress -Activity "Please wait.." -status "Checking $ProcessName" -percentComplete $i
    If (Get-Process $ProcessName -ErrorAction SilentlyContinue) {
    Write Progress -Activity "Please wait.." -status "Stopping $ProcessName" -percentComplete $i
    Stop-Process -processname $processName
    sWriteLogInformation "$processName stopped at $(get-date)"
    } Else {
    sWriteLogInformation "$processName not running."
    Write Progress -Activity "Please wait.." -status "Inserting artificial delay" -percentComplete $i
    start-sleep milliseconds 50
    Not sure where $ProcessName or $strLog are being defined.  I modified your script to clean it up a bit and remove some unnecessary code.
    I hope this post has helped!

  • Powershell script for mailbox permissions

    Hello,
    Part of my tasks as an Exchange admin is to give access to shared mailboxes. The access usually are:
    Send AS
    Receive As
    Send on Behalf Of
    Full mailbox
    Is there a powershell script out there that does all of the above?
    thanks,
    Alexis

    Hi,
    Probably not prewritten, but you can check the repository for starters:
    http://gallery.technet.microsoft.com/scriptcenter
    EDIT: I should mention - this isn't too hard to write, so this could be a good opportunity to learn how to get around in the EMS.
    Don't retire TechNet! -
    (Don't give up yet - 12,830+ strong and growing)

  • Powershell script for Use this termset for site navigation in tem store management tool in central admin

    can anyone pls point out whats the power shell script for "use this  termset for site navigation" in the termstore management tool in my central  admin';s manage serv appln-->managed metadata serv appln ->term styore mgmnt tool
    i would like to check this "checked" through powershell script
    help is appreciated!

    Hi,
    To check if the term set has been set to be used for site navigation, we need to check the
    NavigationTermSet.IsNavigationTermSet property for the term set.
    Here is the code example for using PowerShell to get the setting:
    $site=Get-SPSite "your site collection URL";
    $session = Get-SPTaxonomySession -Site "your site collection URL ";
    $termStore = $session.TermStores["Managed Metadata Service"];
    $Group = $termStore.Groups[“Group Name”];
    $TermSet = $Group.TermSets[“Term Set Name”];
    $navTermSet = [Microsoft.SharePoint.Publishing.Navigation.NavigationTermSet]::GetAsResolvedByWeb($termset, $site.RootWeb, "GlobalNavigationTaxonomyProvider");
    write-host $navTermSet.IsNavigationTermSet
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • Write a ms dos script for rman backup

    Hi all,
    i wanna write a dos batch file to take the rman backup..
    i have written one...actually there are 2 files. one is for login purpose...other one is for sql commands
    rman.bat-->
    rman target sys/sysadmin@hnbhrm @'c:\rm.sql'
    ==============================
    rm.sql-->
    configure retention policy to recovery window of 7 days;
    configure controlfile autobackup on;
    run {
    alter system switch logfile;
    crosscheck archivelog all;
    crosscheck backupset;
    backup database plus archivelog;
    DELETE NOPROMPT ARCHIVELOG ALL COMPLETED BEFORE 'sysdate -1';
    DELETE NOPROMPT OBSOLETE REDUNDANCY = 1;
    ========================================
    but i have problem in first file rman.bat. it doesnt run at all. but if i write sqlplus / as sysdba instead of rman thing.. then it works fine.
    can anybody tell me whats happening over there please..? Have i done this correctly? or u have some other simple way to do this...
    both files are located in C drive.. and oracle is installed to E drive... oracle path has set already.
    can anybody please give me a hand to solve this issue please...
    Thanks in Advance,
    Max

    write a ms dos script for rman backupImpossible. rman does not support MS-DOS. It is not a 16bit real mode application that can be run inside the MS-DOS operating system.
    So get your terminology straight - the Windows console is a character based 32bit virtual machine. It is not MS-DOS. It never was MS-DOS. Do not confuse the two simply because of superficial similarities. A stick-it note can be yellow - but because it is yellow does not mean it is a banana.

  • FIM Reporting ETLScript PowerShell Script for SCSM 2012?

    Hi,
    The FIM Reporting Deployment Guide is great, however on a few occasions it forgets to mention where you meant to execute things (http://technet.microsoft.com/en-us/library/jj133855(v=ws.10).aspx) .
    For example, if it wasn't for the screenshot in the article, we would not have known that we need to run the ETLScript from the FIM Service/Portal server.
    Everything until the ETLScript has thus far worked; and we have deployed the Service Manager 2012 console on the FIM Service/Portal server (since we are using SCSM 2012 for FIM Reporting).
    However, it appears that the ETLScript (in the deployment guide) has been written for SCSM 2010.
    So, has Microsoft or anyone published an updated SCSM 2012 ETLScript script?
    Thanks,
    SK

    Could this be it?
    http://gallery.technet.microsoft.com/PowerShell-Script-to-Run-a4a2081c

  • Powershell script for deleting sitecollection and its content db

     want to know whether any powershell script is avlble for deleting the sitecollection and its content db at oneshot!
    i have created sitecollection specific content db and i wanna delete the same.

    Hi,
    Below link will help to delete site collection
    http://technet.microsoft.com/en-us/library/cc262392(v=office.15).aspx
    Thanks
    Somnath Matere

Maybe you are looking for

  • OS 10.4.11 Mail application

    iMac G5 PPC OS 10.4.11, Mail app. Where can I find my Mail Setup? I had lost my Mail setup and I had to phone my provider so he could steer me to redo my Setup. I followed his instructions and was able to reconnect to my mailboxes. However I did not

  • How do I export a subdirectory of my address book without exporting the entire address book?

    I use sub-directories (contact groups) in my address book for different groups of contacts. I need to move one group to another email client but when using the export function, there does not seem to be any way to select just one group. The export fu

  • Counting rows in a loop

    Hi, I am trying to learn pl/sql and I need some help, please. I have written a package with a cursor and a loop, which returns a file with some lines. The last step I have to do is to write something that returns the number of lines produced in the f

  • OIM 10g Query

    I need a sql query to show approvals for a specific approver. These should be past approvals either approved or deny, or pending approvals. can somebody help

  • Company Code field now shown in Cost Center Master Data

    Hi I am new, I configured CCA. Created Controlling area and versions. When I created a cost center company code field not shown. I think one cost center assined to a one company code but in cost center master data Company code field not shown. I want