App-V 4.6 Powershell script deleteting all shortcuts
Hello,
°not sure if this is more of a powershell issue or app-v issue, feel free to move my topic to the right forum°
Now we have a nice script in production that is supposed to delete all obsolote App-v shortcuts, once a pc starts.
this does very well based on the following function: function Remove-InvalidAppVFTAS()
and $rlist = get-childitem -path $FTARegRoot |?{($_.PSChildName -like ".*") -and ($_.property -contains "SoftgridSource")}
and so on....
BUT if the app-v client is not reachable for example it will still consider as the items are obsolete and delete everything.
Now I would like to achive , that shortcuts are only deleted if the app-v apps are obsolete.
according to the following:
if ($activeapps -notcontains($appv))
$lnk.delete()
if(test-path $lnk.fullname)
the script will delete the shortcuts if the paramater is on inactive, but ofcourse if the app-v client is unreachable, the app is set to inactive, then in an unecessary manner our shortcuts are deleted.
Sorry, I misread this! By the way, does this happen often and what is the cause of the client-server connection going down?
You could have your script also read from the App-V logs for any instances of an error. For more info on the logs, take a look here:
http://blogs.technet.com/b/gladiatormsft/archive/2013/11/13/app-v-on-operational-troubleshooting-of-the-v5-client.aspx
PLEASE MARK ANY ANSWERS TO HELP OTHERS Blog:
rorymon.com Twitter: @Rorymon
Similar Messages
-
What's the standard header in PowerShell scripts (documentation)?
Can anyone tell me what the "standard header" that I see in a lot of PowerShell scripts is all about? I have been unable to find any explanation so far.
Here's a snippet:
<#
.SYNOPSIS
Counts the Grateful Dead shows in my archives
.DESCRIPTION
This script looks at my GD archive, and uses folder names to
determine show type (aud, sbd, etc), and checks to see what
shows have checked MD5s
.NOTES
File Name : count-gdshows.ps1
Author : Thomas Lee - [email protected]
Requires : PowerShell V2 CTP3
.LINKThe help data can be used inside a function body or in a script. A script is not much different than a function, actually you can think of it as a function *without* a name, the name is the script name. You can a function like:
function foo
<#
.SYNOPSIS
Counts the Grateful Dead shows in my archives
#>
param($a,$b)
$a+$b
And execute it like:
foo -a 3 -b 4
or write the function body in a script file called foo.ps1 :
## foo.ps1 ##
<#
.SYNOPSIS
Counts the Grateful Dead shows in my archives
#>
param($a,$b)
$a+$b
and execute it like so:
.\foo.ps1 -a 3 -b 4
they give the same output. Windows 7 is goiung to RTM soon and as you probably know PowerShell v2 ships with it, so you can switch to v2 in the very near future. I'm working with v2 since the CTP versions (on my production machine) and it is working very good, lots of new exiting stuff!
As for functions vs scripts... it depends. On my personal machine I save my functions in various ways. I categorize them and save each bunch in a seperate script file (i.e. utilities.ps1, exchange.ps1, ad.ps1 etc). Some files I use more on a regular basis so I dot-source them in my profile, other scripts I load when I need. v2 introduced a module concept so the next evolution of my script files will turn into modules. I also implement some functions in ps1xml files, these are used to extend objects , via PowerShells' Extended Type System (ETS), you can find an example on my blog (http://blogs.microsoft.co.il/blogs/scriptfanatic/archive/2009/05/31/getting-certificates-expiration.aspx).
Shay Levy [MVP]
http://blogs.microsoft.co.il/blogs/ScriptFanatic
PowerShell Toolbar -
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.
PradeepHi,
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'."; -
Please Vote if you find this to be helpful!
App-V PowerShell: Script to Query XenApp Servers for App-V Publishing Errors and Output an Excel Document with the Results
Just posted this to the wiki:
http://social.technet.microsoft.com/wiki/contents/articles/25323.app-v-powershell-script-to-query-xenapp-servers-for-app-v-publishing-errors-and-output-an-excel-document-with-the-results.aspxHi petro_jemes,
Just a little claritification, you need to add the value to the variable "[string]$ou", and also change the language in the variable "$emailbody" in the function "Get-ADUserPasswordExpirationDate".
I hope this helps. -
Powershell script to change the a column value of all documents in a site.
Hi,
I need a powershell script to change the value of a column (a site column which has been added to all document libraries) in all documents in a site,
For example:
-column 1 is a site column added to all libraries
the value of column 1 of all documents under this site: http://intranet.doman/ex1 should be equal to V1
the value of column 1 of all documents under this site: http://intranet.doman/ex2 should be equal to V2
So, if I can write a powershell script to change the value of all documents in a site, I can modify it for different site that I have and run it for each of them individually,cls
# Is dev version?
$dev = $false
# Configuration
$termStore = "Managed Metadata Service"
$group = "G1"
$subjectMatterTermSetName = "Subject Matter"
# Check if SharePoint Snapin is loaded
if((Get-PSSnapin | Where {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null) {
Add-PSSnapin Microsoft.SharePoint.PowerShell
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Taxonomy") | Out-Null
function GetTermStore($site, $termStore, $group, $termSet) {
$session = New-Object Microsoft.SharePoint.Taxonomy.TaxonomySession($site)
$termStore = $session.TermStores[$termStore]
$group = $termStore.Groups[$group]
$termSet = $group.TermSets[$termSet]
return $termSet
if($dev) {
Write-Host "Running DEV version..."
$webUrl = "http://Site1"
$libraryName = "L1"
$subjectMatter = "C1"
} else {
$webUrl = Read-Host "Enter Site URL"
$libraryName = Read-Host "Enter Document Library name"
$subjectMatter = Read-Host "Enter Subject Matter"
try {
$web = Get-SPWeb $webUrl
$site = $web.Site
$library = $web.Lists[$libraryName]
$items = $library.GetItems()
$subjectMatterTermSet = GetTermStore $site $termStore $group $subjectMatterTermSetName
$subjectMatterTerm = $subjectMatterTermSet.GetTerms($subjectMatter,$true) | select -First 1
foreach($item in $items) {
if([string]::IsNullOrEmpty($item["Subject Matter"])) {
#Write-Host "Filename: $filename / Keywords: $keywords / Subject Matter: $subjectMatter / Document Type: $documentType"
Write-Host "Updating $($item["ows_FileLeafRef"])..."
# Set Subject Matter column
$subjectMatterField = [Microsoft.SharePoint.Taxonomy.TaxonomyField]$item.Fields["Subject Matter"]
$subjectMatterField.SetFieldValue($item,$subjectMatterTerm)
# Update Item
$item.SystemUpdate()
catch
$ErrorMessage = $_.Exception.Message
Write-Host "Something went wrong. Error: $ErrorMessage" -ForegroundColor Red -
Execute a powershell script from a windows store apps
Hello Everybody !
I'd like to launch a powershell script from a windows store apps.
In fact the purpose is install a windows store apps from an other windows store apps.
Any ideas?
ThanksIf it's a sideloaded LOB application, you can do this using a brokered component:
http://blogs.msdn.com/b/wsdevsol/archive/2014/04/14/cheat-sheet-for-using-brokered-windows-runtime-components-for-side-loaded-windows-store-apps.aspx
Matt Small - Microsoft Escalation Engineer - Forum Moderator
If my reply answers your question, please mark this post as answered.
NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined
objects and unknown namespaces. -
Powershell script to get all user profiles with specific email address
Hello,
Please help me. I need a powershell script which can do the following things.
List of all sharepoint user profiles with email address
[email protected]
List of all FBA user profiles with email address [email protected]
List of all Pending Access Requests
Any help is much appreciated. Thanks.
chiragThe script is not working for me. I changed the url according to my site. See the below error
New-Object : Exception calling ".ctor" with "1" argument(s):
"UserProfileApplicationNotAvailableException_Logging ::
UserProfileApplicationProxy.ApplicationProperties ProfilePropertyCache does
not have 3f3a5705-0691-4fe8-8643-cccd65363dc9"
At C:\Scripts\userprofileemails.ps1:11 char:19
+ $profileManager = New-Object
Microsoft.Office.Server.UserProfiles.UserProfileMan ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvoca
tionException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.Power
Shell.Commands.NewObjectCommand
You cannot call a method on a null-valued expression.
At C:\Scripts\userprofileemails.ps1:12 char:1
+ $profiles = $profileManager.GetEnumerator()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Please guide me what to do on this.
Thanks
chirag -
PowerShell script to Retract & Remove all farm solutions
Hi,
I need the PowerShell script to Retract & Remove all SharePoint farm solutions.
Single solution Retract & Remove
Uninstall-SPSolution -Identity <Solution name.wsp>
ex: Uninstall-SPSolution -Identity Solution.wsp
Remove-SPSolution -Identity <Solution name.wsp>
ex: Remove-SPSolution -Identity Solution.wspInstall & Uninstall solutions from folder
file name - installwsp.ps1
Add-PsSnapin Microsoft.SharePoint.PowerShell
#Do not modify anything in the script from here onwards
function Get-ScriptDirectory
$Invocation = (Get-Variable MyInvocation -Scope 1).Value
Split-Path $Invocation.MyCommand.Path
function Deploy-Solution{
param(
[string]$physicalPath,
[string]$name)
$SolutionName = $name
$SolutionPath = Join-Path ($physicalPath) $SolutionName
echo "Extracting information from $physicalPath"
#Admin service
$AdminServiceName = "SPAdminV4"
$IsAdminServiceWasRunning = $true;
if ($(Get-Service $AdminServiceName).Status -eq "Stopped")
$IsAdminServiceWasRunning = $false;
Start-Service $AdminServiceName
Write-Host 'SERVICE WAS STOPPED, SO IT IS NOW STARTED'
#Uninstall
Write-Host 'UNINSTALLING SOLUTION ...'
$Solution = Get-SPSolution | ? {($_.Name -eq $SolutionName) -and ($_.Deployed -eq $true)}
if ($Solution -ne $null)
if($Solution.ContainsWebApplicationResource)
Uninstall-SPSolution $SolutionName -AllWebApplications -Confirm:$false
else
Uninstall-SPSolution $SolutionName -Confirm:$false
while ($Solution.JobExists)
Start-Sleep 2
Write-Host 'SOLUTION HAS BEEN UNINSTALLED SUCCESSFULLY.'
Write-Host 'REMOVING SOLUTION ...'
if ($(Get-SPSolution | ? {$_.Name -eq $SolutionName}).Deployed -eq $false)
Remove-SPSolution $SolutionName -Confirm:$false
Write-Host 'SOLUTION HAS BEEN REMOVED SUCCESSFULLY.'
Write-Host 'ADDING SOLUTION ...'
Add-SPSolution $SolutionPath | Out-Null
Write-Host 'SOLUTION HAS BEEN ADDED SUCCESSFULLY.'
Write-Host 'DEPLOYING SOLUTION ...'
$Solution = Get-SPSolution | ? {($_.Name -eq $SolutionName) -and ($_.Deployed -eq $false)}
#use '-force' paramater to install all commands in this if statement
if(($Solution -ne $null) -and ($Solution.ContainsWebApplicationResource))
Install-SPSolution $SolutionName –AllwebApplications -GACDeployment -Force -Confirm:$false
else
Install-SPSolution $SolutionName -GACDeployment -Force -Confirm:$false
while ($Solution.Deployed -eq $false)
Start-Sleep 2
Write-Host 'SOLUTION HAS BEEN DEPLOYED SUCCESSFULLY.'
if (-not $IsAdminServiceWasRunning)
Stop-Service $AdminServiceName
#Get Current Physical Path
$currentPhysicalPath = Get-ScriptDirectory
#Iterate through all .wsp files in the current Physical Path to deploy solution
get-childitem $currentPhysicalPath -include *.wsp -recurse | foreach ($_) {Deploy-Solution $currentPhysicalPath $_.name}
#Remove SharePoint Snapin
Remove-PsSnapin Microsoft.SharePoint.PowerShell
Echo Finish
Usage file name - installwsp.bat
cd /c %~dp0
powershell -noexit -file "installwsp.ps1" "%CD%"
pause
Anandhan.S Remember to 'mark or propose as answer' or 'vote as helpful' as appropriate. -
Hi there,
Just wondering if someone can give me the PowerShell script to list ALL documents bigger than 10MB - in list attachments/libraries all over my site?
Really appreciated.
Thank you.Hello,
here you can find sample to help you create yoru script :
http://sharepointpromag.com/sharepoint/windows-powershell-scripts-sharepoint-info-files-pagesweb-parts
see this sample extract from this site
Get-SPWeb http://sharepoint/sites/training |
Select -ExpandProperty Lists |
Where { $_.GetType().Name -eq "SPDocumentLibrary" -and
-not $_.Hidden }
|
Select -ExpandProperty Items |
Where { $_.File.Length -gt 5000 } |
Select Name, {$_.File.Length},
@{Name="URL";
Expression={$_.ParentList.ParentWeb.Url
+ "/" + $_.Url}}
this can help too :
https://gallery.technet.microsoft.com/office/Get-detail-report-of-all-b29ea8e2
Best regards, Christopher.
Blog |
Mail
Please remember to click "Mark As Answer" if a post solves your problem or
"Vote As Helpful" if it was useful.
Why mark as answer? -
Hi there,
On my SharePoint site - some places (Sites/Lists etc) have given permissions to "NT Authority\All Authenticated Users"
We need to remove these permissions and instead give permissions to "Forest1\Domain Users" and "Forest1\Domain Users"
PowerSHell script to do above will be appreciated.
Thank you so much.Hello,
In order to check whether "NT Authority\All Authenticated Users" are present in your site use this reference - Link
Remove permission script reference - Link
Finally grant permission script reference - link
Kindly mark it as answer if it helps you.
-Hatim -
PowerShell Scripts to register App to AD
currently we have powershell scripts in place to create Service Principal, but of what I know, for an registered app to be seen in Azure Portal it should have an Application Object as well as a Service Principal. So my question is, if there is an existing
powershell scripts which helps me register an application to AD (Security Principal + Application Object) which would be visible in Portal, for maintenance ahead?Hi PrajaktaSamant,
Thanks for your post!
The applications you see in the portal are projections of the Application entities in the directory. The apps created via powershell are only ServicePrincipals I believe. For a detailed explanation of the difference between the two see
http://msdn.microsoft.com/en-us/library/azure/dn132633.aspx - By vibronet.
You may want to refer this article about
"The Windows Azure AD Application Model".
Best Regards,
Sadiqh -
Hi,
Any help on this?
Thanks
sraboni found one on the Codeplex, this will check Nt auth group, you have to modify accordingly your need and test it in your test farm.script is for 2010 but i am positive it will work for 2013 as well.
The Sixth script lists
all the site collections which have "NT AUTHORITY\authenticated users" in
Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog -
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 -
Powershell Script - Convert Managed Metadata column Value to string
HI,
I have written a small PowerShell Script to pull records from a SP List and put them in a csv file. Here is the script:
$MyWeb = Get-SPWeb "http://dev-apps:8800/applications/PA"
$MyList = $MyWeb.Lists["Alist"]
$exportlist = @()
$Mylist.Items | foreach {
$obj = New-Object PSObject -Property @{
“PName” = $_["Port Name"]
"AName" = $_["Agent Name"]
"Address 1" = $_["Address 1"]
"Address 2" = $_["Address 1"]
"Address 3" = $_["Address 3"]
"Address 4" = $_["Address 4"]
$exportlist += $obj
$exportlist | Export-Csv -path 'C:\Filename.csv'
The script is running all right, the output file is also created, data is also correct for all columns but 1. This PName is a
Managed metadata type column and the output values I am getting for this column are like this:
"ERICA|a6d1e8fd-1f6b-4e09-9830-d21e35950881"
"CLIVE|24dff17f-a1b5-4abe-ae86-57299e1e098b"
viz. the ["Actual Value"|"its GUID"] (seems so). I do not want this GUID to be included in the result csv. Is there a way to remove it.
P.S. Choice column values are being fetched just file.Try this (you'll need to add in your other properties)
$items = New-Object psobject
$items | Add-Member -MemberType NoteProperty -Name "AName" -value "" ;
$items | Add-Member -MemberType NoteProperty -Name "PName" -value "" ;
$items | Add-Member -MemberType NoteProperty -Name "Address1" -value "" ;
$items | Add-Member -MemberType NoteProperty -Name "Address2" -value "" ;
$items | Add-Member -MemberType NoteProperty -Name "Address3" -value "";
$exportlist = @();
$Mylist.Items | foreach {
$pname = $_["PName"] -as [Microsoft.SharePoint.Taxonomy.TaxonomyFieldValue];
$obj = $items | Select-Object *;
$obj.AName = $_["AName"];
$obj.PName = $pname.Label;
$obj.Address1 = $_["Address 1"];
$obj.Address2 = $_["Address 2"];
$obj.Address3 = $_["Address 3"];
$exportlist += $obj
$exportlist | Export-Csv -path 'C:\AData.csv'
Regards, Matthew
MCPD | MCITP
My Blog
View
Matthew Yarlett's profile
See my webpart on the TechNet Gallery that allows administrative users to upload, crop and format user profile photos. Check it out here:
Upload and Crop User Profile Photos -
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 SilentlyContinueI 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
Maybe you are looking for
-
I download lots of news podcasts automatically every hour. In iTunes 7.5 the downloads would disappear from the download folder automatically. Now they stay in the download folder and report done. But they clear. when I click to any new folder. I won
-
How to update with data on two table
Hi, I'm having below problem: Table 1: T_UTR(bdate,rec,id,channel,invoice,prod,proc_date) Table2: t_upd_utr(bdate,rec,id,channel,invoice,prod) I want to update data in t_utr like below: update t_utr set proc_date=sysdate,invoice=t_upd_utr.invoice whe
-
Direct posting from FI to COPA
Hi, We have maintained KEI1 for PA transfer structure for direct FI posting to COPA. Now, when we are trying to post the customer invoice FB70, it recognizes the values based on PA structure, however, it requires manual entry of characteristics. The
-
Installing Mitsumi 7-n-1 Floppy
Done plenty of searching but cannot find any info on the web with detailed instructions. This is a Mitsumi FA404M 7-n-1 Floppy USB drive oem version. The floppy cable port on the back of the drive has only 4 or 5 pins on the bottom row. I'm assuming
-
Startup abend on ACLCHECK.NLM after 3.9SP2
Hello everyone, BM 3.8.X is in use in the environment of the company I am working with, it's working fine for the most part. Edir is 8.8.x On a totally new server (installed in the same container, replica added) running NW65 SP7 with craig johnson re