Powershell to uninstall CMIntegration-MBAM2.5

I am using windows Powershell command to uninstall CMIntegration feature of MBAM 2.5 but I am receiving an error as :-
Environment:-
- SCCM 2012 R2 CAS - Server1
- SQL Server 2012 Sp1 - Server2
- SCCM 2012 R2 Primary Site : Server 3
- MBAM 2.5 Web Server - Server 4
- MBAM 2.5 DBs - Server 5
- Active Directory - Server6
The databases for the CAS and Primary site are on the Same SQL server but on different instances. Reporting Service Point role is enable on CAS. You cannot install Reporting Service Point role on SCCM Server. You need to install it on the SQL server through
configuration manager console. In my case also Reporting Point role is installed on the SQL Server and instance used for the CAS. I haven't faced any issue when installing CMIntegration feature. But I am not able to uninstall it.  
Need help as I am stuck on the client machine. 
Gaurav Ranjan

I've managed to figure this out. If you edit the following key in the registry on your SCCM server
HKLM\SOFTWARE\Microsoft\MBAM Server\Enabled\CMIntegration to 0 and then restart the server it will allow you to re-add the feature with a different config.
Hope that helps

Similar Messages

  • Deploy powershell script - Uninstall Forefront

    Hi
    Im trying to build a powershell script that uninstall Forefront Client and later install SCEP and it also copy the local exclusions from Forefront to insert in SCEP (registry).
    All works fine when Im running the script locally, but when Im deploying it from Altiris DS it halts on Microsoft Forefront Client Security Antimalware Service". Every time, I also have tried to sort them differently but it wont work.
    All I see in the event viewer is a warning:
    "Application 'C:\Program Files\Microsoft Forefront\Client Security\Client\Antimalware\MSASCui.exe' (pid 1964) cannot be restarted - Application SID does not match Conductor SID.."
    And then later an error:
    HRESULT:0x80070643
    Description:Cannot complete the System Center Endpoint Protection installation. An error has prevented the System Center Endpoint Protection setup wizard from completing successfully. Please restart your computer and try again. Error code:0x80070643. Fatal
    error during installation.
    This is the deployment from Altiris:
    powershell.exe -noexit "& 'C:\Temp\ForefrontSCEP.ps1'"
    Does anyone has any clue?
    Cheers!
    **** The script ****
    # Backup Forefront registry data
    Reg export "HKLM\SOFTWARE\Microsoft\Microsoft Forefront" C:\Temp\SCEPClient_New\exclbackup.reg
    # Create new registry item
    new-Item "HKLM:\SOFTWARE\Microsoft\" -Name "Microsoft Antimalware"
    new-Item "HKLM:\SOFTWARE\Microsoft\Microsoft Antimalware\" -Name Exclusions
    # Copy Forefront registry exclusion data to newly created regkey
    Copy-Item "HKLM:\SOFTWARE\Microsoft\Microsoft Forefront\Client Security\1.0\AM\Exclusions" -Destination "HKLM:\SOFTWARE\Microsoft\Microsoft Antimalware\" -Recurs
    # "Uninstall Forefront och MOM"
    # "Uninstall Microsoft MOM"
    $app = Get-WmiObject -Class Win32_Product | Where-Object {
        $_.Name -match "Microsoft Operations Manager 2005 Agent"
    $app.Uninstall()
    # "Uninstall Forefront Assessment"
    $app = Get-WmiObject -Class Win32_Product | Where-Object {
        $_.Name -match "Microsoft Forefront Client Security State Assessment Service"
    $app.Uninstall()
    # "Uninstall Forefront Antimalware"
    $app = Get-WmiObject -Class Win32_Product | Where-Object {
        $_.Name -match "Microsoft Forefront Client Security Antimalware Service"
    $app.Uninstall()
    # Install SCEP with policy
    Start-Process -FilePath C:\Temp\SCEPClient_New\scepinstall.exe -ArgumentList "/s /q /policy C:\Temp\SCEPClient_New\ServerSCEP.xml" -ErrorAction SilentlyContinue

    I finally solved, in two ways.
    For the powershell part:
    I changed the name match against a filter function. So now I can deploy the powershell script just fine.
    $app = Get-WmiObject -Class Win32_Product | Where-Object {
        $_.Name -match "Microsoft Operations Manager 2005 Agent"
    $application = Get-WMIObject Win32_Product -filter "Name='Microsoft Operations Manager 2005 Agent'"
    2nd solution:
    I also created a batch file which worked at my first try. Gotta love the old fashion way :)
    I post it here as well, maybe somebody can get use of it.
    Uninstall Forefront - Install SCEP - Copy local exclusions
    REM Backup Forefront exclusions
    regedit /e C:\Temp\ForefrontExclBackup.reg "HKLM\Software\Microsoft\Microsoft Forefront"
    REM Create SCEP registry keys
    reg add "HKLM\Software\Microsoft\Microsoft Antimalware"
    REM Create SCEP registry keys
    reg add "HKLM\Software\Microsoft\Microsoft Antimalware\Exclusions"
    REM Copy Foreront exclusions to SCEP
    reg copy "HKLM\Software\Microsoft\Microsoft Forefront\Client Security\1.0\AM\Exclusions" "HKLM\Software\Microsoft\Microsoft Antimalware\Exclusions" /s /f
    REM Uninstall Microsoft Forefront Client Security State Assessment Service
    MsiExec.exe /X{E8B56B39-A826-11DB-8C83-0011430C73A4} /qn
    REM Uninstall Microsoft Forefront Client Security Antimalware Service
    MsiExec.exe /X{436028CD-6476-4224-9274-8F0320F30FD1} /qn
    REM Uninstall Microsoft Operations Manager 2005 Agent
    MsiExec.exe /X{F692770D-0E27-4D3F-8386-F04C6F434040} /qn
    REM Install SCEP and policys
    C:\Temp\SCEPInstall.exe /policy C:\Temp\ServerSCEP.xml /s

  • The perspective from my Enterprise ...

    Kudos to Microsoft for adding the _ - X to the top bar on metro apps.  The whole "hot corner" thing was absolutely ridiculous on a desktop computer.  More applause for multi-desktop functionality, sticky notes and the like as well. 
    I thank MS for removing the useless 'A:\' drive as well.  Well done on the placement of the power options too.
    That being said, I'm not seeing a compelling reason for business to abandon Win 7 in this release.  Hopefully in the upcoming releases ...
    1) The OS will decide which UI to display based on input devices available.  (but the user can choose which opens on their profile) This one's a no-brainer.
    2) The ability to embed applications in the desktop.  Lync might be a good place to start. User sizing of those apps.
    3) Metro office apps will be more robust and usable. Excel and Word in particular ... because that's what we actually use in the office. 
    4) The choice to not use metro should not be ignored when opening the start menu.  No tiles in the menu please.  If a user wants tiles, they can just use metro.
    5) A 'log off' key in the power options menu.  A single place for all connection and power options.
    6) Hide the system tray unless the user specifically wants to see it.
    7) A configurable search on the task bar.  Most users want google.
    8) On-board admin tools available to admins only, and when logged in as admin only.
    9) The ability to disable the Microsoft Store in Enterprise, where application installation is tightly controlled using tools such as SCCM or LanDesk. 
    10) If MS is serious about touch screen uptake at the corporate level, dedicate R&D to building a desktop that is actually the top of our office furniture and is touch-enabled.  Until we have horizontal touch devices in front of us paired with vertical
    displays, touch will not be used in the office environment.  The vertical displays would be nifty with faint outlines to indicate our current hand placement.  Vertical touch is a non-starter, and so are horizontal display screens. Both would
    create an inordinate number of worker's comp issues. 
    Win 10 appears to be just a minor revision to Win 8.1, update 1 as it stands now.  Businesses world wide have ignored Win 8 for a reason, and those reasons are still in Win 10.  Enterprise will be ready for touch screen when it becomes something
    that can actually be used in business.  Until then, metro is just unnecessary and distracting fluff.
    Anyway, thanks for letting me state my two cents worth.

    We dismissed the use of Windows 8* in our workplace almost immediately upon reviewing it a couple of years ago, so we've never had to adjust our GPO's to disable the apps store and such.  My apologies for requesting features that we could already control,
    as we've never been forced to control this with Windows 7.  You are correct, disabling the apps store was an easy add in our GPOs.
    I have an 8.1 U1 machine at home, but used powershell to uninstall all the metro apps in order to make it useful.  This strategy seems to work on 10 as well, as long as users aren't re-installing the apps on their machines.
    As far as the admin tools, we already have all our users using 'standard' logins using AD groups and GPOs.  We're just requesting that the tools not be visible without local admin privileges. Our users are, for the most part, not power users.
    Once again though, we are looking for a viable upgrade path from Win 7, and just aren't seeing a compelling reason in this OS. 

  • How to Install/UnInstall Visual studio extension using PowerShell

    Hi all.
    I try to install / uninstall visual studio extension use PowerShell script
    But I just can find the Install like: start-process $visualextendsionpath.
    I can't not find the way to uninstall the extension.
    Do I use this command to install is correct? And please suggest me the way to unInstall the extension by PowerShell script.
    Thank

    Hi Bruce,
    In addition, Since I'm not familar the VSIX, however, to uninstall package with powershell, these cmdlets are for your reference:
    Removes an app package (.appx): Remove-AppxPackage
    To get the installed package :
    Get-AppxPackage
    Or if you want to uninstall app listed in 'Add or Remove Programs', please also check this script:
    $app = Get-WmiObject -Class Win32_Product | Where-Object {
    $_.Name -match "Software Name"
    $app.Uninstall()
    If there is anything regarding this script, please feel free to post back.
    Best Regards,
    Anna Wang

  • Cannot uninstall windows powershell in order to upgrade from win2k3 ent x64 to win2k8 ent x64

    I can't seem to uninstall windows powershell in order to upgrade my windows 2003 enterprise x64 server to win2k8 ent x64.  It says...
    You must make the following changes before upgrading Windows
    Uninstall the following programs:
    Windows PowerShell
    I read if I uninstall kb926139 I will in essence uninstall powershell, however I'm being told in add/remove programs that the program cannot be removed, nor is windows powershell displayed as an installed application.

    Hi,
    I suggest uninstalling SP2 first and then trying to uninstall Powershell.
    If the issue persists, you may consider performing an In-Place Upgrade of Windows Server 2003 and then upgrade to Windows Server 2008.
    How to Perform an In-Place Upgrade of Windows Server 2003
    http://support.microsoft.com/?id=816579
    Before doing that, please backup important data on your system first.
    Hope it helps.
    Tim Quan - MSFT

  • How to uninstall Windows PowerShell

    I attempted In-Place install of Vista SP2 over an exiting Vista SP2, then a message said I must uninstall Windows PowerShell.  There is its short-cut in the program folder but there is no such entry in Add/Remove list.
    How can I uninstall the Windows Powershell?

    Also read:
    http://technet.microsoft.com/en-us/library/dd351188.aspx
    Uninstall Previous Versions of Windows PowerShell and Windows Remote Management
                3 out of 28 rated this helpful
    - Rate this topic
    Applies to: Exchange Server 2010 SP2
    Topic Last Modified: 2011-03-19
    You need to uninstall previous versions of Windows PowerShell and Windows Remote Management (WinRM) before you can install Windows Management Framework, which includes Windows PowerShell 2.0 and WinRM 2.0. This procedure should be performed on computers
    running Windows Vista, Windows Server 2008, Windows Server 2003, or Windows XP.
    You don't need to perform this procedure on computers running Windows 7 or Windows Server 2008 R2. The current version of Windows Management Framework is already installed on these operating systems.
    Looking for other management tasks related to Windows PowerShell and Windows Remote Management? Check out
    Managing Exchange Management Shell Connections.
    Note:
    If you want to run remote Shell on a computer that already has Microsoft Exchange Server 2010 installed, you don't need to perform this procedure. Instead, for more information about how to open the Shell with the Exchange management tools installed, see
    Open the Shell.
    What Do You Want To Do?
    Remove Windows PowerShell on Windows Vista
    Remove Windows PowerShell on Windows Server 2008 with the built-in version of Windows PowerShell installed
    Remove Windows PowerShell on Windows Server 2008 with a pre-release version of Windows PowerShell V2 installed
    Remove WinRM on Windows Vista and Windows Server 2008
    Remove Windows PowerShell on Windows Server 2003 and Windows XP
    Remove WinRM on Windows Server 2003 and Windows XP
    Remove Windows PowerShell on Windows Vista
    You need to be assigned permissions before you can perform this procedure. To see what permissions you need, see the "PowerShell and WinRM installation" entry in the
    Exchange and Shell Infrastructure Permissions topic.
    In Control Panel, in Programs, open
    Programs and Features.
    Uninstall any instances of Windows PowerShell that appear in the installed programs list or the installed updates list. Previous versions may appear as
    Windows PowerShell(TM) V2 if you have installed the Community Technology Preview (CTP) versions of Windows PowerShell v2. If Windows PowerShell v1 is installed, it might be listed as a Windows update with one of the following Knowledge Base
    article numbers:
    KB928439
    KB923569
    Note:
    You might need to click the View installed updates link in the Tasks sidebar to view currently installed updates.
    Remove Windows PowerShell on Windows Server 2008 with the built-in version of Windows PowerShell installed
    You need to be assigned permissions before you can perform this procedure. To see what permissions you need, see the "PowerShell and WinRM installation" entry in the
    Exchange and Shell Infrastructure Permissions topic.
    Start Server Manager and navigate to Features.
    Click Uninstall Features.
    Select Windows PowerShell and follow the directions to uninstall.
    Remove Windows PowerShell on Windows Server 2008 with a pre-release version of Windows PowerShell 2.0 installed
    You need to be assigned permissions before you can perform this procedure. To see what permissions you need, see the "PowerShell and WinRM installation" entry in the
    Exchange and Shell Infrastructure Permissions topic.
    In Control Panel, in Programs, open
    Programs and Features.
    Uninstall any instances of Windows PowerShell that appear in the installed programs list or the installed updates list.
    Note:
    You might need to click the View installed updates link in the Tasks sidebar to view currently installed updates.
    Remove WinRM on Windows Vista and Windows Server 2008
    You need to be assigned permissions before you can perform this procedure. To see what permissions you need, see the "PowerShell and WinRM installation" entry in the
    Exchange and Shell Infrastructure Permissions topic.
    In Control Panel, in Programs, open
    Programs and Features.
    Uninstall any instances of Windows Remote Management that appear in the installed programs list or the installed updates list. WinRM might be listed as a Windows update with one of the following Knowledge Base articles numbers:
    KB936059
    KB950099
    Note:
    You might need to click the View installed updates link in the Tasks sidebar to view currently installed updates.
    Remove Windows PowerShell on Windows Server 2003 and Windows XP
    In Control Panel, open Add or Remove Programs.
    Uninstall any instances of Windows PowerShell that appear in the installed programs list or the installed updates list. Windows PowerShell might be listed as a Windows update with the Knowledge Base article number KB926139.
    Note:
    You might need to select the Show updates box to view currently installed updates.
    Remove WinRM on Windows Server 2003 and Windows XP
    In Control Panel, open Add or Remove Programs.
    Uninstall any instances of Windows Remote Management that appear in the installed programs list or the installed updates list. WinRM might be listed as a Windows update with the Knowledge Base article number KB936059.
    Note:
    You might need to select the Show updates box to view currently installed updates.
    Other Tasks for Peace!
    Devnullius
    After you uninstall all previously installed versions of Windows PowerShell and WinRM, you need to install Windows Management Framework. For more information, see
    Install Windows Management Framework.

  • DPInst uninstall using powershell

    Hello everybody,
    i'm new in powershell and trying to script multiple driver uninstall through DPInst
    DPInst.exe /S /u "my.inf"
    After many search i'm still looking for help.
    Thank you.

    Hi Anthony,
    If the cmd you posted can work on a single driver, please refer to the script below to run against multiple drivers, which use foreach to loop every .inf file in powershell, please note I haven't tested:
    $inffiles="d:\1.inf","d:\2.inf"
    foreach($file in $inffiles){
    $cmd = "DPInst.exe /S /u $file"
    Invoke-Expression $cmd}
    If there is anything else regarding this issue, please feel free to post back.
    Best Regards,
    Anna Wang
    TechNet Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Question regarding PowerShell script to Uninstall security updates in Windows 7/8

    Hello Everyone,
    I came across a great link on the Scriptcenter  
    https://gallery.technet.microsoft.com/scriptcenter/Uninstall-security-update-76f2dcb7  which has a PowerShell download that enables you to remove Microsoft updates from computers.  When I download the zip files ->extract it,  I have a
    file called " UninstallHotFix.psm1 ".   So far so good.  But where I am totally lost is in the directions to use this file. 
    Specifically: 
    Method 1:
    Download the script and open the script file together with Notepad or any other script editor.
    Scroll down to the end of the script file, and then add the example command which you want to run.
    Save the file then run the script in PowerShell
    I assume (1) refers to right clicking on "UninstallHotFix.psm1" and opening it with notepad?
    If I want to run the following...    Uninstall-OSCHotfix -HotFixID KB2830290   do I just paste it at the end of notepad?
    Do I save the file and attempt to run in powershell as a .psm1 file - or as a .ps1  file?
    Lost in Space....
    Adrian

    Hi Adrian,
    If the above doesn't help, I recommend posting questions about this item on the QandA tab of the script module:
    https://gallery.technet.microsoft.com/scriptcenter/Uninstall-security-update-76f2dcb7/view/Discussions#content
    I'd recommend following the steps in Method 2 on the gallery item. As an overview:
    1. Save the zip file into C:\Temp
    2. Extract the zip to C:\Temp\UninstallHotFix(PowerShell)
    3. Open a PS console and type the following:
    Import-Module 'C:\Temp\UninstallHotFix(PowerShell)\UninstallHotFix(PowerShell)\UninstallHotFix.psm1'
    You can verify that the module has been loaded by running Get-Module:
    PS C:\> Get-Module
    ModuleType Version Name ExportedCommands
    Manifest 3.1.0.0 Microsoft.PowerShell.Management {Add-Computer, Add-Content, Checkpoint
    Script 0.0 UninstallHotFix {Uninstall-OSCHotfix, UninstallHotFix}
    Don't retire TechNet! -
    (Don't give up yet - 13,225+ strong and growing)

  • Trying to uninstall a program with msixec from powershell

    Of course you can tailor your msiexec session however you like. The syntax for the msiexec command can be found here:
    https://technet.microsoft.com/en-us/library/cc759262%28v=ws.10%29.aspx

    I have attempted the following methods. I either get the msiexec window popping up, or exit code: "This action is only valid for products that are currently installed."Powershell $app = Get-WmiObject -Class Win32_Product -Filter "Name = 'StorageCraft ShadowControl'" $app.IdentifyingNumber (Start-Process -FilePath "msiexec.exe" -ArgumentList "/x $($app.IdentifyingNumber) /qn" -Wait -Passthru).ExitCode Start-Process msiexec.exe '/x {DABFF9C1-048E-43B1-ACEB-C47FB9502DB0} /qn' Start-Process -FilePath "$env:systemroot\system32\msiexec.exe" -ArgumentList "/x {DABFF9C1-048E-43B1-ACEB-C47FB9502DB0} /qn" -Wait $command = "msiexec.exe /x {DABFF9C1-048E-43B1-ACEB-C47FB9502DB0} /qn" Invoke-Expression -Command:$command $allArgs = @('/x', '{DABFF9C1-048E-43B1-ACEB-C47FB9502DB0}', '/qn') & $env:systemroot\system32\msiexec.exe $allArgsPowershellI ...
    This topic first appeared in the Spiceworks Community

  • Uninstalled a program via PowerShell script, but it still shows up in Programs and Features

    I wrote a script that uninstalls a program just fine, but it still shows up in Programs and Features due to its entries still existing in the Registry. 
    Here is a portion of my script:
    Start-Process
    -FilePath MsiExec
    -ArgumentList "/X$($MyProgram.ProdID)",
    '/quiet'
    -NoNewWindow -Wait
    -PassThru 
    I believe the reason it is still showing up in Programs and Features is because I am missing some MsiExec switch to instruct it to be removed. I vaguely recall dealing with this about two years ago and I wrote a script that did exactly this, but now I completely
    forgot what it was. 
    Can someone help me out here, please?
    Thank you

    I realize that, but honestly don't know where else to submit a question like this in the forums? Also, the vendor is Microsoft. What I am trying to uninstall is any Forefront component, because when I deployed the SCEP client via SCCM 2012 the SCEP client
    was not able to uninstall some of the Forefront components. 
    Here is my script:
    $NewLine = "`r`n"
    $NewLine
    Write-Output "Please wait ..."
    #region ---------- Declare WMI Variables to be Used ----------
    $CM12R2ClientInstalled = Get-WmiObject -Class Win32_Product |
    Where-Object -FilterScript { $_.Name -eq "Configuration Manager Client" -and $_.Version -ge "5.00.7958.1000" }
    $FCSInstalled = Get-WmiObject -Class Win32Reg_AddRemovePrograms |
    Where-Object -FilterScript { $_.DisplayName -match "Forefront" }
    $SCEPInstalled = Get-WmiObject -Class Win32Reg_AddRemovePrograms |
    Where-Object -FilterScript { $_.DisplayName -eq "System Center Endpoint Protection" }
    #endregion ---------- Declare Variables to be Used ----------
    #region --------- Check if the SCCM 2012 R2 Client is Installed ---------
    $CM12ClientService = Get-Service -Name CcmExec
    If (($CM12R2ClientInstalled -ne $null) -and ($CM12ClientService -ne $null))
    $NewLine
    Write-Output "The $($CM12R2ClientInstalled.Name) $($CM12R2ClientInstalled.Version) is installed on $($env:COMPUTERNAME)"
    #endregion --------- Check if the SCCM 2012 R2 Client is Installed ---------
    #region -------- Uninstall any Forefront Component if any are Installed ---------
    If ($FCSInstalled)
    $NewLine
    Write-Output "The following Forefront component(s) are installed on $($env:COMPUTERNAME):"
    $NewLine
    $FCSInstalled.DisplayName
    Foreach ($FCS in $FCSInstalled)
    $NewLine
    Write-Output "Preparing to uninstall $($FCS.DisplayName)"
    $UninstallFCS = Start-Process -FilePath MsiExec -ArgumentList "/X$($FCS.ProdID)", 'REMOVEDATA=1' -NoNewWindow -Wait -PassThru
    If ($($UninstallFCS.ExitCode) -eq '0')
    $NewLine
    Write-Output "$($FCS.DisplayName) uninstalled successfully!"
    $NewLine
    #endregion -------- Uninstall any Forefront Component if any are Installed ---------
    #region --------- Install the SCEP Client if it is Not Installed ----------
    If ($SCEPInstalled -eq $null)
    $NewLine
    Write-Output "The System Center Endpoint Protection client is not installed on $($env:COMPUTERNAME)"
    $InstallSCEP = Start-Process -FilePath "C:\Windows\ccmsetup\SCEPInstall.exe" -ArgumentList '/s', '/q', '/NoSigsUpdateAtInitialExp', '/policy "C:\Windows\CCM\EPAMPolicy.xml"' -NoNewWindow -Wait -PassThru
    If ($($InstallSCEP.ExitCode) -eq '0')
    $NewLine
    Write-Output "System Center Endpoint Protection installed successfully!"
    $NewLine
    Else
    $NewLine
    Write-Warning -Message "System Center Endpoint Protection failed to install on $($env:COMPUTERNAME) with exit error: $($InstallSCEP.ExitCode)"
    $NewLine
    #endregion --------- Install the SCEP Client if it is Not Installed ----------
    Else
    $NewLine
    Write-Output "The System Center Endpoint Protection client is already installed on $($env:COMPUTERNAME)!"
    $NewLine
    Else
    $NewLine
    Write-Warning -Message "$($FCS.DisplayName) failed to uninstall on $($env:COMPUTERNAME) with exit error: $($UninstallFCS.ExitCode)"
    $NewLine
    Else
    $NewLine
    Write-Output "No Forefront components are installed on $($env:COMPUTERNAME)!"
    #region ---------- Install the SCEP Client if it is NOT Installed ----------
    If ($SCEPInstalled -eq $null)
    $NewLine
    Write-Output "The System Center Endpoint Protection client is not installed on $($env:COMPUTERNAME)"
    $InstallSCEP = Start-Process -FilePath "C:\Windows\ccmsetup\SCEPInstall.exe" -ArgumentList '/s', '/q', '/NoSigsUpdateAtInitialExp', '/policy "C:\Windows\CCM\EPAMPolicy.xml"' -NoNewWindow -Wait -PassThru
    If ($($InstallSCEP.ExitCode) -eq '0')
    $NewLine
    Write-Output "System Center Endpoint Protection installed successfully!"
    $NewLine
    Else
    $NewLine
    Write-Warning -Message "System Center Endpoint Protection failed to install on $($env:COMPUTERNAME) with exit error: $($InstallSCEP.ExitCode)"
    $NewLine
    #endregion --------- Install the SCEP Client if it is Not Installed ----------
    Else
    $NewLine
    Write-Output "The System Center Endpoint Protection client is already installed on $($env:COMPUTERNAME)!"
    $NewLine
    Else
    $NewLine
    Write-Output "The System Center Configuration Manager 2012 R2 client is not installed on $($env:COMPUTERNAME)!"
    $NewLine

  • How can I use PowerShell to Remove "Ghost" (Old Hidden) VMware Network Adapters in Windows 7?

    We recently upgrade the virtual hardware of some of our VMware VM's running Windows 7. One side-effect is that in Windows on these machines, an instance of the NIC from the previous version of virtual hardware remains, as a hidden
    device. This can be easily found manually on a machine by enabling Device manager to show hidden devices (registry and a menu option - View...Show Hidden Devices). You can then just right-click on the device in question and uninstall.
    The problem here, like in so many other tasks, is that you may have multiple instances, on multiple machines. We had just that, and in scouring the internet for a PowerShell only script to resolve the issue, I could not find one. Therefore, I've written
    my own.
    This exact script is only seeking out VMware "VMXNET3" nic cards, but could be easily adapted to find Ghost NIC's for a different vendor using my example. There are also some commented lines left in to aid you as an example of how you can
    test the various queries in your own environment, on a test machine, before a full-blown deployment. 
    NOTE: Please try this out (at your own risk - I am not responsible for how this works out for you), and please vote for my answer to this dilemma if this helped you. I'd appreciate it after all of the sweat the script took to crank out.
    Thanks!
    P.S. This script, of course, requires that Powershell is installed and enabled on the target computer. It then must be run as System - In our environment it is being remotely pushed through a software delivery systems, which runs this scrpt
    as system.
    THE SCRIPT:
    CLS
    #Querying WMI for Ghost NICs and Returning Criteria...
     Write-Host "VMware Ghost NIC Remover" -Foreground GREEN
     Write-Host "Author: Octavio Serpa AKA Octavio-Admin"
     Write-Host "Copyright Octavio Serpa - Octavio-Admin - 2014"
     Write-Host ""
     Write-Host "Checking Powershell Version" -Foreground Yellow
     $host.version
     Write-Host ""
     Write-Host "Searching for Ghost NIC's" -Foreground Yellow
     $Ghosts = gwmi win32_NetworkAdapter | ?{$_.Description -like "vm*" -and $_.Installed -like "True" -and $_.MACAddress -eq $null}
     $Ghosts | Select-Object Name,DeviceID
     If ($Ghosts -NE $NULL)
      Write-Host "One or more ghost NIC'S do exist on this machine. Script will continue..." -foreground RED
      Write-Host ""    
      else
      Write-Host "No ghost NIC's Found :) - Exiting..." -Foreground Green
      Write-Host ""    
      EXIT 0
    #Using Criteria to Obtain the GUID of each Ghost NIC
     Write-Host "Getting NIC Variables" -Foreground Yellow
     foreach ($_ in $Ghosts) {
      $DID = $_.DeviceID
      If ($DID -NE $NULL)
      Write-Host "The NIC DID: $DID"
      else
      Write-Host "$DID is NULL - Exiting..."
      EXIT 666
      if($DID -NOTLIKE "1*")
       Write-Host "Adding additional 0 to registry lookup since the DID is just one character..." - foreground yellow
       Write-Host "" 
       $NICREG = Get-ItemProperty "hklm:\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\000$DID"
      ELSE
       $NICREG = Get-ItemProperty "hklm:\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\00$DID"
      $GUID = $NICREG.NetCfgInstanceId
      Write-Host "The NIC GUID: $GUID"
                    $PNPDID = $NICREG.DeviceInstanceID
      $PNPDID = $PNPDID.Trimstart("PCI\VEN_15AD&DEV_07B0&SUBSYS_07B015AD&REV_01\")
      Write-Host "The truncated PNPDevice ID is $PNPDID"
      Write-Host ""
      Write-Host "Searching for Registry Keys that match NIC GUID: $GUID" -Foreground Yellow
      $NICREGPATH = @(1..50)
      foreach ($_ in $NICREGPATH)
       $TESTREG = Test-Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\$_" -Verbose
       if($TESTREG -EQ $FALSE)
        #Write-Host ""
        #Write-Host "FALSE: HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\$_ DOES NOT EXIST" -Foreground RED     
        ELSE
        #Write-Host "True - NIC $_ Exists" -Foreground Green
        $NICID = $_    
        $SubPath1 = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\'+$NICID
        #Write-Host "The Sub-Key Path To Query = $SubPath1"
        $SubPath2 = 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\NetworkCards\'+$NICID
        #Write-Host "The Sub-Key Path To Query = $SubPath2"
        $NICProperties = Get-ItemProperty $SubPath1
        #$NICProperties
        $Match = $NICProperties.ServiceName    
        #$Match
        foreach ($_ in $Match) {
        #Write-Host "The NIC GUID found in this registry key is: $_" -Foreground Yellow
        #Write-Host ""
        if($_ -NE $GUID)
        #Write-Host "NO MATCH - THIS NIC HAS NOT BEEN TOUCHED" -Foreground GREEN
                                    #Write-Host ""
        ELSE
        Write-Host "MATCH - Registry Entries for this NIC will be DELETED" -Foreground RED
        Remove-Item $SubPath1 -Recurse  -ErrorAction SilentlyContinue
        Remove-Item $SubPath2 -Recurse  -ErrorAction SilentlyContinue
        $CCS = @("ControlSet001", "ControlSet002")
        foreach ($_ in $CCS) {
         $CCS = $_
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\Services\'+$GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose 
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\Services\Tcpip\Parameters\Adapters\'+$GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\Control\DeviceClasses\{ad498944-762f-11d0-8dcb-00c04fc3358c}\##?#PCI#VEN_15AD&DEV_07B0&SUBSYS_07B015AD&REV_01#$PNPDID#{ad498944-762f-11d0-8dcb-00c04fc3358c}\#'+$GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\'+$GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\services\JNPRNA\Parameters\Adapters\' + $GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\services\NetBT\Parameters\Interfaces\Tcpip_' + $GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\services\Psched\Parameters\NdisAdapters\' + $GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\services\Tcpip\Parameters\Adapters\' + $GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\services\Tcpip\Parameters\DNSRegisteredAdapters\' + $GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\services\Tcpip\Parameters\Interfaces\' + $GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\services\WfpLwf\Parameters\NdisAdapters\' + $GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
                                             if($DID -NOTLIKE
    "1*")
                  $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\000' + $DID
                             Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
           ELSE
           $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\00' + $DID
           Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\Enum\PCI\VEN_15AD&DEV_07B0&SUBSYS_07B015AD&REV_01\' + $PNPDID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
    #This is our Success check at the end
     Write-Host ""
     Write-Host "Searching for any remaining Ghost NICs:" -Foreground Yellow
              $Ghosts = gwmi win32_NetworkAdapter | ?{$_.Description -like "vm*" -and $_.Installed -like "True" -and $_.MACAddress -eq $null}
     $Ghosts | Select-Object Name,DeviceID
      If ($Ghosts -NE $NULL)
      Write-Host "There is still at least one ghost NIC present. The remover script may not be functioning correctly. Please contact Octavio-Admin on Microsoft Technet Forums with any questions" -foreground RED
      Write-Host ""
      EXIT 666
      else
      Write-Host "No ghost NIC's Found :) - Exiting..." -Foreground Green
      Write-Host ""    
      EXIT 0

    THE SCRIPT:
    CLS
    #Querying WMI for Ghost NICs and Returning Criteria...
    Write-Host "VMware Ghost NIC Remover" -Foreground GREEN
    Write-Host "Author: Octavio Serpa AKA Octavio-Admin"
    Write-Host "Copyright Octavio Serpa - Octavio-Admin - 2014"
    Write-Host ""
    Write-Host "Checking Powershell Version" -Foreground Yellow
    $host.version
    Write-Host ""
    Write-Host "Searching for Ghost NIC's" -Foreground Yellow
    $Ghosts = gwmi win32_NetworkAdapter | ?{$_.Description -like "vm*" -and $_.Installed -like "True" -and $_.MACAddress -eq $null}
    $Ghosts | Select-Object Name,DeviceID
    If ($Ghosts -NE $NULL)
      Write-Host "One or more ghost NIC'S do exist on this machine. Script will continue..." -foreground RED
      Write-Host ""   
      else
      Write-Host "No ghost NIC's Found :) - Exiting..." -Foreground Green
      Write-Host ""   
      EXIT 0
    #Using Criteria to Obtain the GUID of each Ghost NIC
    Write-Host "Getting NIC Variables" -Foreground Yellow
    foreach ($_ in $Ghosts) {
      $DID = $_.DeviceID
      If ($DID -NE $NULL)
      Write-Host "The NIC DID: $DID"
      else
      Write-Host "$DID is NULL - Exiting..."
      EXIT 666
      if($DID -NOTLIKE "1*")
       Write-Host "Adding additional 0 to registry lookup since the DID is just one character..." - foreground yellow
       Write-Host ""
       $NICREG = Get-ItemProperty "hklm:\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\000$DID"
      ELSE
       $NICREG = Get-ItemProperty "hklm:\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\00$DID"
      $GUID = $NICREG.NetCfgInstanceId
      Write-Host "The NIC GUID: $GUID"
                    $PNPDID = $NICREG.DeviceInstanceID
      $PNPDID = $PNPDID.Trimstart("PCI\VEN_15AD&DEV_07B0&SUBSYS_07B015AD&REV_01\")
      Write-Host "The truncated PNPDevice ID is $PNPDID"
      Write-Host ""
      Write-Host "Searching for Registry Keys that match NIC GUID: $GUID" -Foreground Yellow
      $NICREGPATH = @(1..50)
      foreach ($_ in $NICREGPATH)
       $TESTREG = Test-Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\$_" -Verbose
       if($TESTREG -EQ $FALSE)
        #Write-Host ""
        #Write-Host "FALSE: HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\$_ DOES NOT EXIST" -Foreground RED    
        ELSE
        #Write-Host "True - NIC $_ Exists" -Foreground Green
        $NICID = $_   
        $SubPath1 = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\'+$NICID
        #Write-Host "The Sub-Key Path To Query = $SubPath1"
        $SubPath2 = 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\NetworkCards\'+$NICID
        #Write-Host "The Sub-Key Path To Query = $SubPath2"
        $NICProperties = Get-ItemProperty $SubPath1
        #$NICProperties
        $Match = $NICProperties.ServiceName   
        #$Match
        foreach ($_ in $Match) {
        #Write-Host "The NIC GUID found in this registry key is: $_" -Foreground Yellow
        #Write-Host ""
        if($_ -NE $GUID)
        #Write-Host "NO MATCH - THIS NIC HAS NOT BEEN TOUCHED" -Foreground GREEN
                                    #Write-Host ""
        ELSE
        Write-Host "MATCH - Registry Entries for this NIC will be DELETED" -Foreground RED
        Remove-Item $SubPath1 -Recurse  -ErrorAction SilentlyContinue
        Remove-Item $SubPath2 -Recurse  -ErrorAction SilentlyContinue
        $CCS = @("ControlSet001", "ControlSet002")
        foreach ($_ in $CCS) {
         $CCS = $_
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\Services\'+$GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\Services\Tcpip\Parameters\Adapters\'+$GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\Control\DeviceClasses\{ad498944-762f-11d0-8dcb-00c04fc3358c}\##?#PCI#VEN_15AD&DEV_07B0&SUBSYS_07B015AD&REV_01#$PNPDID#{ad498944-762f-11d0-8dcb-00c04fc3358c}\#'+$GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\'+$GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\services\JNPRNA\Parameters\Adapters\' + $GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\services\NetBT\Parameters\Interfaces\Tcpip_' + $GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\services\Psched\Parameters\NdisAdapters\' + $GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\services\Tcpip\Parameters\Adapters\' + $GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\services\Tcpip\Parameters\DNSRegisteredAdapters\' + $GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\services\Tcpip\Parameters\Interfaces\' + $GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\services\WfpLwf\Parameters\NdisAdapters\' + $GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
                                             if($DID -NOTLIKE
    "1*")
                  $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\000' + $DID
                             Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
           ELSE
           $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\00' + $DID
           Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\Enum\PCI\VEN_15AD&DEV_07B0&SUBSYS_07B015AD&REV_01\' + $PNPDID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
    #This is our Success check at the end
    Write-Host ""
    Write-Host "Searching for any remaining Ghost NICs:" -Foreground Yellow
              $Ghosts = gwmi win32_NetworkAdapter | ?{$_.Description -like "vm*" -and $_.Installed -like "True" -and $_.MACAddress -eq $null}
    $Ghosts | Select-Object Name,DeviceID
      If ($Ghosts -NE $NULL)
    Write-Host "There is still at least one ghost NIC present. The remover script may not be functioning correctly. Please contact Octavio-Admin on Microsoft Technet Forums with any questions" -foreground RED
      Write-Host ""
      EXIT 666
      else
      Write-Host "No ghost NIC's Found :) - Exiting..." -Foreground Green
      Write-Host ""   
      EXIT 0
    Hello Octavio,
    I'm having similar issues with azure VMs (windows server 2008 and 2012). I noticed that the name of the network adapter changes every time the servers are turned off and then on.
    For example every time I perform that action on each VM, the network adapter became to "Microsoft Hyper-V Network Adapter #3" (and then #4, #5, etc).
    I found in to many forums that to resolve that is needed to remove Hidden (Ghost) Network Adapters and most of the people is doing that manually from the device manager (right click on the hidden network adapter and select uninstall).
    Then I found this script created by you and made some changes to find Description -like "Microsoft Hyper-V Network*".
    It seems to find the adapters and also remove them (based on the script results). But if I go to the device manager after restarting the server, all hidden (ghost) adapters are still there (for example Microsoft Hyper-V Network Adapter
    #2, Microsoft Hyper-V Network Adapter #3, Microsoft Hyper-V Network Adapter #4, Microsoft Hyper-V Network Adapter #n).
    The only thing I noticed after running the script is that, in the Control Panel -> Network and Sharing Center, the name of the adapter has no # (Now is shown as “Ethernet” and before as “Ethernet #”)
    This is my script, could you please take a look and tell me if there is something wrong o missing?
    CLS
    #Querying WMI for Ghost NICs and Returning Criteria...
    Write-Host "VMware Ghost NIC Remover" -Foreground GREEN
    Write-Host "Author: Octavio Serpa AKA Octavio-Admin"
    Write-Host "Copyright Octavio Serpa - Octavio-Admin - 2014"
    Write-Host ""
    Write-Host "Checking Powershell Version" -Foreground Yellow
    $host.version
    Write-Host ""
    Write-Host "Searching for Ghost NIC's" -Foreground Yellow
    $Ghosts = gwmi win32_NetworkAdapter | ?{$_.Description -like "Microsoft Hyper-V Network*" -and $_.Installed -like "True" -and $_.MACAddress -eq $null}
    $Ghosts | Select-Object Name,DeviceID
    If ($Ghosts -NE $NULL)
      Write-Host "One or more ghost NIC'S do exist on this machine. Script will continue..." -foreground RED
      Write-Host ""    
      else
      Write-Host "No ghost NIC's Found :) - Exiting..." -Foreground Green
      Write-Host ""    
      EXIT 0
    #Using Criteria to Obtain the GUID of each Ghost NIC
    Write-Host "Getting NIC Variables" -Foreground Yellow
    foreach ($_ in $Ghosts) {
      $DID = $_.DeviceID
      If ($DID -NE $NULL)
      Write-Host "The NIC DID: $DID"
      else
      Write-Host "$DID is NULL - Exiting..."
      EXIT 666
      if($DID -NOTLIKE "1*")
       Write-Host "Adding additional 0 to registry lookup since the DID is just one character..." - foreground yellow
       Write-Host "" 
       $NICREG = Get-ItemProperty "hklm:\SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\000$DID"
      ELSE
       $NICREG = Get-ItemProperty "hklm:\SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\00$DID"
      $GUID = $NICREG.NetCfgInstanceId
      Write-Host "The NIC GUID: $GUID"
                    $PNPDID = $NICREG.DeviceInstanceID
      $PNPDID = $PNPDID.Trimstart("PCI\VEN_15AD&DEV_07B0&SUBSYS_07B015AD&REV_01\")
      Write-Host "The truncated PNPDevice ID is $PNPDID"
      Write-Host ""
      Write-Host "Searching for Registry Keys that match NIC GUID: $GUID" -Foreground Yellow
      $NICREGPATH = @(1..50)
      foreach ($_ in $NICREGPATH)
       $TESTREG = Test-Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\$_" -Verbose
       if($TESTREG -EQ $FALSE)
        #Write-Host ""
        #Write-Host "FALSE: HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\$_ DOES NOT EXIST" -Foreground RED     
        ELSE
        #Write-Host "True - NIC $_ Exists" -Foreground Green
        $NICID = $_   
        $SubPath1 = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\'+$NICID
        #Write-Host "The Sub-Key Path To Query = $SubPath1"
        $SubPath2 = 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\NetworkCards\'+$NICID
        #Write-Host "The Sub-Key Path To Query = $SubPath2"
        $NICProperties = Get-ItemProperty $SubPath1
        #$NICProperties
        $Match = $NICProperties.ServiceName    
        #$Match
        foreach ($_ in $Match) {
        #Write-Host "The NIC GUID found in this registry key is: $_" -Foreground Yellow
        #Write-Host ""
        if($_ -NE $GUID)
        #Write-Host "NO MATCH - THIS NIC HAS NOT BEEN TOUCHED" -Foreground GREEN
                                    #Write-Host ""
        ELSE
        Write-Host "MATCH - Registry Entries for this NIC will be DELETED" -Foreground RED
        Remove-Item $SubPath1 -Recurse  -ErrorAction SilentlyContinue
        Remove-Item $SubPath2 -Recurse  -ErrorAction SilentlyContinue
        $CCS = @("ControlSet001", "ControlSet002")
        foreach ($_ in $CCS) {
         $CCS = $_
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\Services\'+$GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose 
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\Services\Tcpip\Parameters\Adapters\'+$GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\Control\DeviceClasses\{ad498944-762f-11d0-8dcb-00c04fc3358c}\##?#PCI#VEN_15AD&DEV_07B0&SUBSYS_07B015AD&REV_01#$PNPDID#{ad498944-762f-11d0-8dcb-00c04fc3358c}\#'+$GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\'+$GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\services\JNPRNA\Parameters\Adapters\' + $GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\services\NetBT\Parameters\Interfaces\Tcpip_' + $GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\services\Psched\Parameters\NdisAdapters\' + $GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\services\Tcpip\Parameters\Adapters\' + $GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\services\Tcpip\Parameters\DNSRegisteredAdapters\' + $GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\services\Tcpip\Parameters\Interfaces\' + $GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\services\WfpLwf\Parameters\NdisAdapters\' + $GUID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
                                             if($DID -NOTLIKE "1*")
                  $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\000' + $DID
                             Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
           ELSE
           $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\00' + $DID
           Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
         $reg1 = 'HKLM:\SYSTEM\' + $CCS + '\Enum\PCI\VEN_15AD&DEV_07B0&SUBSYS_07B015AD&REV_01\' + $PNPDID
         Remove-Item $reg1 -Recurse  -ErrorAction SilentlyContinue -verbose
    #This is our Success check at the end
    Write-Host ""
    Write-Host "Searching for any remaining Ghost NICs:" -Foreground Yellow
              $Ghosts = gwmi win32_NetworkAdapter | ?{$_.Description -like "Microsoft Hyper-V Network*" -and $_.Installed -like "True" -and $_.MACAddress -eq $null}
    $Ghosts | Select-Object Name,DeviceID
      If ($Ghosts -NE $NULL)
    Write-Host "There is still at least one ghost NIC present. The remover script may not be functioning correctly. Please contact Octavio-Admin on Microsoft Technet Forums with any questions" -foreground RED
      Write-Host ""
      EXIT 666
      else
      Write-Host "No ghost NIC's Found :) - Exiting..." -Foreground Green
      Write-Host ""    
      EXIT 0

  • Trying to deploy a batch or powershell script unsuccessful

    I've deployed a .cmd file out that contains a WMI script to uninstall all instances of an application called "VirtViewer". The script looks like this:
    taskkill /F /IM remote-viewer.exe /T
    wmic product where "name like 'VirtViewer%%'" call uninstall /nointeractive
    exit /B %EXIT_CODE%
    Previously, I had used MSI product codes for the uninstall, and got the same result. My original problem, is that there are currently 9 different versions of this app out there, so i am ripping them all out and replacing with 1 version. Installing over an
    old version does not overwrite the older one, it instead installs a new instance.
    Reading through the execmgr.log on the client, everything looks as it should.
    The end result, is that nothing happens. I had originally set the program to run as hidden, but then changed it to normal but still do not see it run. The application is right where i left it, untouched. If i run the script locally it works fine, but not
    when deployed. Am i missing something??
    <![LOG[Service startup.]LOG]!><time="16:09:31.647+300" date="01-12-2015" component="execmgr" context="" type="1" thread="248" file="execmgr.cpp:135">
    <![LOG[A user has logged on.]LOG]!><time="16:09:43.507+300" date="01-12-2015" component="execmgr" context="" type="1" thread="4256" file="execreqmgr.cpp:4911">
    <![LOG[Requesting content from CAS for package VNT00018 version 21]LOG]!><time="16:11:13.649+300" date="01-12-2015" component="execmgr" context="" type="1" thread="124" file="contentaccesshelper.cpp:246">
    <![LOG[Policy arrived for parent package VNT00018 program Uninstall Script]LOG]!><time="16:11:13.649+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2528" file="execreqmgr.cpp:6893">
    <![LOG[Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="VNT00018",ProgramID="Uninstall Script", actionType 6l, value NULL, user NULL, session 4294967295l, level 0l, verbosity 30l]LOG]!><time="16:11:13.665+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2528" file="event.cpp:405">
    <![LOG[Successfully created a content request handle {B2BA42EE-5988-47F4-BF44-ADAAC975994B} for the package VNT00018 version 21]LOG]!><time="16:11:13.665+300" date="01-12-2015" component="execmgr" context="" type="1" thread="124" file="contentaccesshelper.cpp:331">
    <![LOG[Program Uninstall Script change to state STATE_ADVANCED_DOWNLOAD content available]LOG]!><time="16:11:13.665+300" date="01-12-2015" component="execmgr" context="" type="2" thread="124" file="executionrequest.cpp:3663">
    <![LOG[Execution Request for advert VNT20014 package VNT00018 program Uninstall Script state change from NotExist to AdvancedDownload]LOG]!><time="16:11:13.665+300" date="01-12-2015" component="execmgr" context="" type="1" thread="124" file="executionrequest.cpp:501">
    <![LOG[Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="VNT00018",ProgramID="Uninstall Script", actionType 1l, value , user NULL, session 4294967295l, level 0l, verbosity 30l]LOG]!><time="16:11:13.665+300" date="01-12-2015" component="execmgr" context="" type="1" thread="124" file="event.cpp:405">
    <![LOG[Raising event:
    [SMS_CodePage(437), SMS_LocaleID(1033)]
    instance of SoftDistProgramOfferReceivedEvent
    AdvertisementId = "VNT20014";
    ClientID = "GUID:E306FF26-C884-4E36-9C03-C19523A17F40";
    DateTime = "20150112211113.665000+000";
    MachineName = "VM-WIN7-MIKE";
    ProcessID = 1788;
    SiteCode = "VNT";
    ThreadID = 2528;
    ]LOG]!><time="16:11:13.665+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2528" file="event.cpp:715">
    <![LOG[Mandatory execution requested for program Uninstall Script and advertisement VNT20014]LOG]!><time="16:11:13.680+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="execreqmgr.cpp:3527">
    <![LOG[Creating mandatory request for advert VNT20014, program Uninstall Script, package VNT00018]LOG]!><time="16:11:13.680+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="execreqmgr.cpp:3653">
    <![LOG[An existing MTC token was not supplied, using ExecutionRequest's Id as MTC token and this execution request is the owner of resultant MTC task.]LOG]!><time="16:11:13.696+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="executionrequest.cpp:8942">
    <![LOG[Request a MTC task for execution request of package VNT00018, program Uninstall Script with request id: {D52026A7-5735-402B-868C-EF9791656512}]LOG]!><time="16:11:13.696+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="executionrequest.cpp:8966">
    <![LOG[Execution Request for advert VNT20014 package VNT00018 program Uninstall Script state change from WaitingDependency to Ready]LOG]!><time="16:11:13.712+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="executionrequest.cpp:501">
    <![LOG[MTC task with id {D52026A7-5735-402B-868C-EF9791656512}, changed state from 0 to 4]LOG]!><time="16:11:13.712+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="execreqmgr.cpp:6288">
    <![LOG[Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="VNT00018",ProgramID="Uninstall Script", actionType 1l, value , user NULL, session 4294967295l, level 0l, verbosity 30l]LOG]!><time="16:11:13.712+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="event.cpp:405">
    <![LOG[MTC signaled SWD execution request with program id: Uninstall Script, package id: VNT00018 for execution.]LOG]!><time="16:11:13.743+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="execreqmgr.cpp:6406">
    <![LOG[Sending ack to MTC for task with id: {D52026A7-5735-402B-868C-EF9791656512}]LOG]!><time="16:11:13.743+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="executionrequest.cpp:9005">
    <![LOG[Executing program VirtViewerUninstall.cmd in Admin context]LOG]!><time="16:11:13.743+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="executionrequest.cpp:3239">
    <![LOG[Execution Request for advert VNT20014 package VNT00018 program Uninstall Script state change from Ready to NotifyExecution]LOG]!><time="16:11:13.743+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="executionrequest.cpp:501">
    <![LOG[Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="VNT00018",ProgramID="Uninstall Script", actionType 1l, value , user NULL, session 4294967295l, level 0l, verbosity 30l]LOG]!><time="16:11:13.759+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="event.cpp:405">
    <![LOG[Checking content location C:\Windows\ccmcache\1c for use]LOG]!><time="16:11:13.774+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="executioncontext.cpp:1663">
    <![LOG[Successfully selected content location C:\Windows\ccmcache\1c]LOG]!><time="16:11:13.774+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="executioncontext.cpp:1719">
    <![LOG[Executing program as a script]LOG]!><time="16:11:13.774+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="executionengine.cpp:82">
    <![LOG[Successfully prepared command line "C:\Windows\ccmcache\1c\VirtViewerUninstall.cmd"]LOG]!><time="16:11:13.774+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="scriptexecution.cpp:650">
    <![LOG[Command line = "C:\Windows\ccmcache\1c\VirtViewerUninstall.cmd", Working Directory = C:\Windows\ccmcache\1c\]LOG]!><time="16:11:13.774+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="scriptexecution.cpp:352">
    <![LOG[Running "C:\Windows\ccmcache\1c\VirtViewerUninstall.cmd" with 32bitLauncher]LOG]!><time="16:11:13.774+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="scriptexecution.cpp:370">
    <![LOG[Created Process for the passed command line]LOG]!><time="16:11:13.852+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="scriptexecution.cpp:513">
    <![LOG[Raising event:
    [SMS_CodePage(437), SMS_LocaleID(1033)]
    instance of SoftDistProgramStartedEvent
    AdvertisementId = "VNT20014";
    ClientID = "GUID:E306FF26-C884-4E36-9C03-C19523A17F40";
    CommandLine = "\"C:\\Windows\\ccmcache\\1c\\VirtViewerUninstall.cmd\"";
    DateTime = "20150112211113.852000+000";
    MachineName = "VM-WIN7-MIKE";
    PackageName = "VNT00018";
    ProcessID = 1788;
    ProgramName = "Uninstall Script";
    SiteCode = "VNT";
    ThreadID = 2164;
    UserContext = "NT AUTHORITY\\SYSTEM";
    WorkingDirectory = "C:\\Windows\\ccmcache\\1c\\";
    ]LOG]!><time="16:11:13.852+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="event.cpp:715">
    <![LOG[Raised Program Started Event for Ad:VNT20014, Package:VNT00018, Program: Uninstall Script]LOG]!><time="16:11:13.852+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="executioncontext.cpp:459">
    <![LOG[Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="VNT00018",ProgramID="Uninstall Script", actionType 1l, value NULL, user NULL, session 4294967295l, level 0l, verbosity 30l]LOG]!><time="16:11:13.852+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="event.cpp:405">
    <![LOG[Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="VNT00018",ProgramID="Uninstall Script", actionType 1l, value , user NULL, session 4294967295l, level 0l, verbosity 30l]LOG]!><time="16:11:13.868+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="event.cpp:405">
    <![LOG[MTC task with id {D52026A7-5735-402B-868C-EF9791656512}, changed state from 4 to 5]LOG]!><time="16:11:13.884+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="execreqmgr.cpp:6288">
    <![LOG[Program exit code 0]LOG]!><time="16:11:17.571+300" date="01-12-2015" component="execmgr" context="" type="1" thread="4128" file="scriptexecution.cpp:676">
    <![LOG[Looking for MIF file to get program status]LOG]!><time="16:11:17.571+300" date="01-12-2015" component="execmgr" context="" type="1" thread="4128" file="executionstatus.cpp:282">
    <![LOG[Script for Package:VNT00018, Program: Uninstall Script succeeded with exit code 0]LOG]!><time="16:11:17.571+300" date="01-12-2015" component="execmgr" context="" type="1" thread="4128" file="executionstatus.cpp:262">
    <![LOG[Raising event:
    [SMS_CodePage(437), SMS_LocaleID(1033)]
    instance of SoftDistProgramCompletedSuccessfullyEvent
    AdvertisementId = "VNT20014";
    ClientID = "GUID:E306FF26-C884-4E36-9C03-C19523A17F40";
    DateTime = "20150112211117.571000+000";
    MachineName = "VM-WIN7-MIKE";
    PackageName = "VNT00018";
    ProcessID = 1788;
    ProgramName = "Uninstall Script";
    SiteCode = "VNT";
    ThreadID = 4128;
    UserContext = "NT AUTHORITY\\SYSTEM";
    ]LOG]!><time="16:11:17.587+300" date="01-12-2015" component="execmgr" context="" type="1" thread="4128" file="event.cpp:715">
    <![LOG[Raised Program Success Event for Ad:VNT20014, Package:VNT00018, Program: Uninstall Script]LOG]!><time="16:11:17.587+300" date="01-12-2015" component="execmgr" context="" type="1" thread="4128" file="executioncontext.cpp:483">
    <![LOG[Execution is complete for program Uninstall Script. The exit code is 0, the execution status is Success]LOG]!><time="16:11:17.587+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="execreqmgr.cpp:4165">
    <![LOG[Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="VNT00018",ProgramID="Uninstall Script", actionType 10l, value Result:TRUE ,SDKCallerId:, user NULL, session 4294967295l, level 0l, verbosity 30l]LOG]!><time="16:11:17.602+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="event.cpp:405">
    <![LOG[Requesting MTC to delete task with id: {D52026A7-5735-402B-868C-EF9791656512}]LOG]!><time="16:11:17.618+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="executionrequest.cpp:9036">
    <![LOG[MTC task with id: {D52026A7-5735-402B-868C-EF9791656512} deleted successfully.]LOG]!><time="16:11:17.618+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="executionrequest.cpp:9065">
    <![LOG[Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="VNT00018",ProgramID="Uninstall Script", actionType 1l, value , user NULL, session 4294967295l, level 0l, verbosity 30l]LOG]!><time="16:11:17.618+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="event.cpp:405">

    I just tried using powershell to accomplish the same task, and got the same result. Script ran fine, but nothing resulted. 0 errors in the execmgr.log on the client.
    Program options:
    Command Line: Powershell.exe -executionpolicy Bypass -file .\VirtUninstall.ps1
    the powershell script looks like this:
    $app = Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -match "VirtViewer*"}
    $app.Uninstall()
    exit /B
    Again, the script runs great when launched locally, but not wehen deployed

  • Cannot create mysites from powershell: Original XSLT List View Web Part not found

    I have a bizarre problem in my SharePoint 2013 farm. This does not occur in my test farm, only in the farm we were going to go live with.
    I'm on windows Server 2012, SQLServer 2012 SP1, SharePoint 2013 April CU. 1 appserver/centraladmin server, 2 web servers.
    When I log into our mysitehost and click newsfeed, it will create a mysite (even though first it displays "we are sorry there was a problem creating your site")
    But from powershell, whether I use $UserProfile.CreatePersonalSite() or New-SPSite, I get the following error:
    Original XSLT List View Web Part not found
    So far I've only found one other person with this:
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/2503e42c-e114-4e89-8e00-89fe70f0b154/cannot-create-sharepoint-mysite-programmatically
    This is a brand new farm, created with the same scripts I created my test farm with, and same version of SharePoint. Only the service accounts are different. (Farm account has admin on the servers right now since I was setting up profile service).
    Some other errors from the same correlation ID that look related:
    It can't seem to find the listemplate 101
    And something looks wrong with the MySiteDocumentLibrary feature
    I have tried the following:
    1. run psconfig.exe on each server
    2. install-spfeature -AllExistingFeatures
    3. looped through the directory under Features and for each called Install-SPFeature $dirname -Force
    4. uninstalled and reinstalled MySiteDocumentLibrary feature
    5. blew away the whole farm (removed all servers from farm, deleted all databases) and recreated it.
    6. tried creating the UPA from the CentralAdmin gui.
    The only real difference I can think of between the working farm and non working farm is, I installed the working farm using RTM, then as they came out added the March PU and April CU. For this farm I installed RTM and March and April, and then ran my build
    farm script.
    I am at a loss. What do I need to do, re-install the binaries? That's all I can think of. What I love is that our test / POC system worked fine, and now 2 weeks before go-live I'm seeing errors on the production servers I've never seen before. Using the
    same scripts no less.
    Feature Activation: Feature 'Fields' (ID: 'ca7bd552-10b1-4563-85b9-5ed1d39c962a') was activated
    Feature Activation: Feature 'CTypes' (ID: '695b6570-a48b-4a8e-8ea5-26ea7fc1d162') was activated
    No document templates uploaded for list "$Resources:core,global_onet_solutiongallery_list;" -- none found for list template "100"
    Failed to find <ListTemplate> tag corresponding to ID "101", tried both onet.xml for site definition ID "0" language "1033" and global site definition. Operation failed.
    No document templates uploaded for list "$Resources:core,stylelibraryList;" -- none found for list template "121".
    System.Runtime.InteropServices.COMException: A user may not remove his or her own account from a site collection.<nativehr>0x81020051</nativehr><nativestack></nativestack>, StackTrace: at Microsoft.SharePoint.SPUserCollection.UpdateMembers
    Feature Activation: Feature 'MySitePersonalSite' (ID: 'f661430e-c155-438e-a7c6-c68648f1b119') was activated
    Feature Activation: Activating Feature 'MySiteDocumentLibrary'
    Calling 'FeatureActivated' method of SPFeatureReceiver for Feature 'MySiteDocumentLibrary'
    SharePoint Foundation Upgrade MySiteDocumentLibraryFeatureReceiveraj08n INFO Creating new My Documents library
    Unknown SPRequest error occurred. More information: 0x80070002
    SPRequest.GetMetadataForUrl: UserPrincipalName=, AppPrincipalName= ,bstrUrl=http://contoso/personal/cbuchholz/DOCUMENTS ,METADATAFLAGS=59
    System.IO.FileNotFoundException: <nativehr>0x80070002</nativehr><nativestack></nativestack>, StackTrace: at Microsoft.SharePoint.SPWeb.GetObjectForUrl at Microsoft.SharePoint.Portal.UserProfiles.MySiteDocumentLibraryUtil.GetSPObjectFromUrl ...
    <nativehr>0x80070002</nativehr><nativestack></nativestack>There is no Web named "/personal/cbuchholz/DOCUMENTS"
    Possible mismatch between the reported error with code = 0x81070504 and message: "There is no Web named "/personal/cbuchholz/DOCUMENTS"." and the returned error with code 0x80070002.
    Attemping to add webpart id 0F6072F2-E804-4CFD-837E-BB37332B9D1C to web http://contoso/personal/cbuchholz
    Adding XsltListViewWebPart calling SPRequest::CreateListViewPart. Web part id 0F6072F2-E804-4CFD-837E-BB37332B9D1C, web http://contoso/personal/cbuchholz
    Feature receiver assembly 'Microsoft.SharePoint.Portal, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c', class 'Microsoft.SharePoint.Portal.UserProfiles.MySiteDocumentLibraryFeatureReceiver', method 'FeatureActivated' for feature 'e9c0ff81-d821-4771-8b4c-246aa7e5e9eb' threw an exception: System.InvalidOperationException: Original XSLT List View Web Part not found at Microsoft.SharePoint.Portal.UserProfiles.MySiteDocumentLibraryUtil.ReplaceListViewWebPart
    Feature Activation: Threw an exception, attempting to roll back. Feature 'MySiteDocumentLibrary'
    Exception in EnsureFeaturesActivatedAtSite: System.InvalidOperationException: Original XSLT List View Web Part not found
    Failed to activate site-collection-scoped features for template 'SPSPERS#2' in site collection 'http://contoso/personal/cbuchholz'
    Failed to apply template "SPSPERS#2" to web at URL "http://contoso/personal/cbuchholz
    I've had other problems in this farm: the bug where when you add Administrators to a Search Service via the Manage Service Applications page, it removes the SPSearchDBAdmin role from the search service process account. That one did not happen in the other farm.
    At least other people have that one and I could just use the farm admin instead (still troublng of course).

    Ok,
    Here is the problem:
    When creating a mysite from powershell or script, apparently you can ONLY do this from a wfe (or a server running Microsoft SharePoint Foundation Web Application in services on server).
    You CANNOT create mysites from script on your appserver if it is not also a Web Application Server. I confirmed the same is true in my test farm. I guess I was always running most of these scripts on the webserver.
    I searched all over and cannot find this documented anywhere.
    Who do I contact to have Microsoft document this?
    It's Thursday morning, I've been working non stop since Saturday morning so you don't have to :)

  • Error while adding the app in the sharepoint(2013) page through powershell script

    Hi,
        I have created one powershell script to uninstall and install the sharepoint 2013 apps. The code is working fine, but after adding the app in the page I am getting the error "
    Internet Explorer can not display the webpage".
    If I am deploying the app through Visual Studio, its getting deployed successfully and I am getting an option to trust the app.And I am able to add it in the page. But this permission is not coming when I am installing the app using power shell.
    Please let me know whether to do any modifications to the power shell script.
    Thanks.
    Pradeep

    Hi,
       We are using sharepoint hosted app.
    Below is the script to uninstall and install the app.
    cls
    Add-PSSnapin Microsoft.SharePoint.PowerShell –ea SilentlyContinue
    # uninstall the app
    Write-Host "uninstallation of app"
    $InstalledSPApps = Get-SPAppInstance -Web "http://mySharepointSite.xyz.com"
    $appToUninstall = $InstalledSPApps | where {$_.Title -eq 'myCustomSharepointApp'}
    if ($appToUninstall -ne $null)
        Uninstall-SPAppInstance -Identity $appToUninstall ;
        Write-Host "uninstalled successfully"
    # Import-SPAppPackage
    Write-Host "Import the app"
    pause
    $sourceApp = ([microsoft.sharepoint.administration.spappsource]::RemoteObjectModel);
    $myspapp = Import-SPAppPackage -Path "D:\SharePoint 2013\AppsSolution\myCustomSharepointApp.app" -Site "http://mySharepointSite.xyz.com" -Source $sourceApp ;
    Write-Host "Enter to install the app"
    pause
    $app = Install-SPApp -Web "http://mySharepointSite.xyz.com" -Identity $myspapp;
    $AppName = $app.Title;
    Write-Host "app '$AppName' registered"
    pause
    $appInstance = Get-SPAppInstance -Web "http://mySharepointSite.xyz.com" | where-object {$_.Title -eq $AppName};
    $counter = 1;
    $maximum = 150;
    $sleeptime = 2;
    Write-Host -ForegroundColor White "Please wait..." -NoNewline;
    pause
    while (($appInstance.Status -eq ([Microsoft.SharePoint.Administration.SPAppInstanceStatus]::Installing)) -and ($counter -lt $maximum))
        Write-Host "." -NoNewline;
        sleep $sleeptime;
        $counter++;
        $appInstance = Get-SPAppInstance -Web "http://mySharepointSite.xyz.com" | where-object {$_.Title -eq $AppName}
    pause
    if ($appInstance.Status -eq [Microsoft.SharePoint.Administration.SPAppInstanceStatus]::Installed)
        Write-Host "The App was successfully installed.";
        $appUrl = $appInstance.AppWebFullUrl;
        Write-Host -ForegroundColor White "The App is available at '$appUrl'.";

  • Error when uninstalling App-V RDS client: Product: Microsoft Application Virtualization (App-V) Client for Remote Desktop Services 5.0 Service Pack 2 x64 -- Error 1324. The folder path 'C:' contains an invalid character

    Issue:  experienced when attempting to uninstall the App-V 5.0 SP2 RDS client. 
    Event Log:  Product: Microsoft Application Virtualization (App-V) Client for Remote Desktop Services 5.0 Service Pack 2 x64 -- Error 1324. The folder
    path 'C:' contains an invalid character
    Symptoms (when in this current state): 
    Unable to uninstall the SP2 client
    You can upgrade the client (via hotfix) and uninstall the hotfix, but you will not be able to remove the SP2 client
    AppvVfs filter driver will not create an instance, therefore applications will not be able to read into existing streamed VFS content, or trigger sparse files to stream content.  (you can still stream the content via other means, like the UI or powershell)
    Because of the AppvVfs filter driver not instantiating, applications that depend on licences that exist in VFS will not be able to be read causing certain applications to react as if the license does not exist or is an incorrect format

    Resolution:
    Check for the existence of a hidden folder named %appdata% in the C:\Program Files\Microsoft Application Virtualization\Client folder.  (You will need to un-check the folder options box in windows explorer for "Hide
    protected operating system files" to see it)
    If the hidden %appdata% folder exists, delete it.
    Proceed to uninstall the App-V client
    After a clean uninstall and removal of remnants of the client, reinstall the client again and apply the latest hotfix available (Hotfix 2 for SP2 at a minimum).

Maybe you are looking for