Related Content
- 12 years ago
var oShell = Sys.OleObject(\"WScript.Shell\");
var strCmd = \"wmic process where\" +
\" (CommandLine like '%Higgens%' and name like '%Higgens%'\" +
\" or CommandLine like '%AnotherApp%' and name like '%AnotherApp%')\" +
\" call terminate\";
// Run the command and get the exit code
var res = oShell.Run(strCmd, 0 /* run in background */, true /* wait for completion */);
if (res != 0) {
Log.Message(\"WMIC command failed; exit code \" + res);
}
","body@stripHtml({\"removeProcessingText\":false,\"removeSpoilerMarkup\":false,\"removeTocMarkup\":false,\"truncateLength\":200})@stringLength":"213","kudosSumWeight":1,"repliesCount":0,"postTime":"2015-01-18T22:47:56.000-08:00","lastPublishTime":"2015-01-18T22:47:56.000-08:00","solution":true,"metrics":{"__typename":"MessageMetrics","views":1111},"visibilityScope":"PUBLIC","placeholder":false,"originalMessageForPlaceholder":null,"isEscalated":null,"entityType":"FORUM_REPLY","eventPath":"category:TestComplete_forum/community:nwkab66374board:testcomplete-questions/message:94523/message:94526","replies":{"__typename":"MessageConnection","pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null},"edges":[]},"customFields":[],"attachments":{"__typename":"AttachmentConnection","edges":[],"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}},"body@stripHtml({\"removeProcessingText\":true,\"removeSpoilerMarkup\":true,\"removeTocMarkup\":true,\"truncateLength\":200})@stringLength":"213","images":{"__typename":"AssociatedImageConnection","edges":[],"totalCount":0,"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}},"videos":{"__typename":"VideoConnection","edges":[],"totalCount":0,"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}}},"ModerationData:moderation_data:94532":{"__typename":"ModerationData","id":"moderation_data:94532","status":"APPROVED","rejectReason":null,"isReportedAbuse":false,"rejectUser":null,"rejectTime":null,"rejectActorType":null},"ForumReplyMessage:message:94532":{"__typename":"ForumReplyMessage","author":{"__ref":"User:user:51988"},"id":"message:94532","revisionNum":1,"uid":94532,"depth":1,"hasGivenKudo":false,"subscribed":false,"board":{"__ref":"Forum:board:testcomplete-questions"},"parent":{"__ref":"ForumTopicMessage:message:94523"},"conversation":{"__ref":"Conversation:conversation:94523"},"subject":"Re: jscript quoting error help?","moderationData":{"__ref":"ModerationData:moderation_data:94532"},"body":"thank you! I wrapped your powershell call in a function Test {} and it works great. Yes, indeed I think \"it may be more convenient to use for handling errors and troubleshooting.\"","body@stripHtml({\"removeProcessingText\":false,\"removeSpoilerMarkup\":false,\"removeTocMarkup\":false,\"truncateLength\":200})@stringLength":"179","kudosSumWeight":0,"repliesCount":0,"postTime":"2015-01-20T05:12:53.000-08:00","lastPublishTime":"2015-01-20T05:12:53.000-08:00","metrics":{"__typename":"MessageMetrics","views":1111},"visibilityScope":"PUBLIC","placeholder":false,"originalMessageForPlaceholder":null,"isEscalated":null,"solution":false,"entityType":"FORUM_REPLY","eventPath":"category:TestComplete_forum/community:nwkab66374board:testcomplete-questions/message:94523/message:94532","replies":{"__typename":"MessageConnection","pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null},"edges":[]},"customFields":[],"attachments":{"__typename":"AttachmentConnection","edges":[],"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}}},"QueryVariables:MessageSolutions":{"__typename":"QueryVariables","id":"MessageSolutions","value":{"first":10,"constraints":{"topicId":{"eq":"message:94523"},"solution":{"eq":true}},"sorts":{"postTime":{"direction":"ASC"}},"useAvatar":true,"useAuthorLogin":true,"useAuthorRank":false,"useBody":true,"useKudosCount":false,"useTimeToRead":false,"useMedia":true,"useRepliesCount":false,"useSearchSnippet":false,"useAcceptedSolutionButton":true,"useSolvedBadge":false,"useAttachments":true,"useTags":false,"useUserHoverCard":true,"useNodeHoverCard":true,"usePreviewSubjectModal":false,"useMessageStatus":false}},"CachedAsset:text:en_US-components/messages/EscalatedMessageBanner-1720711077000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/EscalatedMessageBanner-1720711077000","value":{"escalationMessage":"Escalated to Salesforce by {username} on {date}","viewDetails":"View Details","modalTitle":"Case Details","escalatedBy":"Escalated by: ","escalatedOn":"Escalated on: ","caseNumber":"Case Number: ","status":"Status: ","lastUpdateDate":"Last Update: ","automaticEscalation":"automatic escalation","anonymous":"Anonymous"},"localOverride":false},"CachedAsset:text:en_US-components/users/UserLink-1720711077000":{"__typename":"CachedAsset","id":"text:en_US-components/users/UserLink-1720711077000","value":{"authorName":"View Profile: {author}","anonymous":"Anonymous"},"localOverride":false},"CachedAsset:text:en_US-shared/client/components/users/UserRank-1720711077000":{"__typename":"CachedAsset","id":"text:en_US-shared/client/components/users/UserRank-1720711077000","value":{"rankName":"{rankName}","userRank":"Author rank {rankName}"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageTime-1720711077000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageTime-1720711077000","value":{"postTime":"Published: {time}","lastPublishTime":"Last Update: {time}","conversation.lastPostingActivityTime":"Last posting activity time: {time}","conversation.lastPostTime":"Last post time: {time}","moderationData.rejectTime":"Rejected time: {time}"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageSubject-1720711077000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageSubject-1720711077000","value":{"noSubject":"(no subject)"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageBody-1720711077000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageBody-1720711077000","value":{"showMessageBody":"Show More","mentionsErrorTitle":"{mentionsType, select, board {Board} user {User} message {Message} other {}} No Longer Available","mentionsErrorMessage":"The {mentionsType} you are trying to view has been removed from the community.","videoProcessing":"Video is being processed. Please try again in a few minutes.","bannerTitle":"Video provider requires cookies to play the video. Accept to continue or {url} it directly on the provider's site.","buttonTitle":"Accept","urlText":"watch"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageCustomFields-1720711077000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageCustomFields-1720711077000","value":{"CustomField.default.label":"Value of {name}"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageReplyButton-1720711077000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageReplyButton-1720711077000","value":{"repliesCount":"{count}","title":"Reply","title@board:BLOG@message:root":"Comment","title@board:TKB@message:root":"Comment","title@board:IDEA@message:root":"Comment","title@board:OCCASION@message:root":"Comment"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageSolutionList-1720711077000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageSolutionList-1720711077000","value":{"emptyDescription":"No has been message solutions yet"},"localOverride":false},"CachedAsset:text:en_US-components/messages/AcceptedSolutionButton-1720711077000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/AcceptedSolutionButton-1720711077000","value":{"accept":"Mark as Solution","accepted":"Marked as Solution","errorHeader":"Error!","errorAdd":"There was an error marking as solution.","errorRemove":"There was an error unmarking as solution.","solved":"Solved"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageView/MessageViewInline-1720711077000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageView/MessageViewInline-1720711077000","value":{"bylineAuthor":"{bylineAuthor}","bylineBoard":"{bylineBoard}","anonymous":"Anonymous","place":"Place {bylineBoard}","gotoParent":"Go to parent {name}"},"localOverride":false},"CachedAsset:text:en_US-shared/client/components/common/Pager/PagerLoadMore-1720711077000":{"__typename":"CachedAsset","id":"text:en_US-shared/client/components/common/Pager/PagerLoadMore-1720711077000","value":{"loadMore":"Show More"},"localOverride":false},"CachedAsset:text:en_US-shared/client/components/users/UserAvatar-1720711077000":{"__typename":"CachedAsset","id":"text:en_US-shared/client/components/users/UserAvatar-1720711077000","value":{"altText":"{login}'s avatar","altTextGeneric":"User's avatar"},"localOverride":false},"CachedAsset:text:en_US-shared/client/components/ranks/UserRankLabel-1720711077000":{"__typename":"CachedAsset","id":"text:en_US-shared/client/components/ranks/UserRankLabel-1720711077000","value":{"altTitle":"Icon for {rankName} rank"},"localOverride":false},"CachedAsset:text:en_US-shared/client/components/nodes/NodeIcon-1720711077000":{"__typename":"CachedAsset","id":"text:en_US-shared/client/components/nodes/NodeIcon-1720711077000","value":{"contentType":"Content Type {style, select, FORUM {Forum} BLOG {Blog} TKB {Knowledge Base} IDEA {Ideas} OCCASION {Events} other {}} icon"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageSolvedBadge-1720711077000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageSolvedBadge-1720711077000","value":{"solved":"Solved"},"localOverride":false}}}},"page":"/forums/ForumMessagePage/ForumMessagePage","query":{"boardId":"testcomplete-questions","messageSubject":"jscript-quoting-error-help","messageId":"94523"},"buildId":"OKtI0OLKuXmERTJKBVqYX","runtimeConfig":{"buildInformationVisible":false,"logLevelApp":"info","logLevelMetrics":"info","openTelemetryClientEnabled":false,"openTelemetryConfigName":"smartbear","openTelemetryServiceVersion":"24.11.0","openTelemetryUniverse":"prod","openTelemetryCollector":"http://localhost:4318","openTelemetryRouteChangeAllowedTime":"5000","apolloDevToolsEnabled":false},"isFallback":false,"isExperimentalCompile":false,"dynamicIds":["./components/seo/QAPageSchema/QAPageSchema.tsx","./components/community/Navbar/NavbarWidget.tsx","./components/community/Breadcrumb/BreadcrumbWidget.tsx","./components/messages/TopicWithThreadedReplyListWidget/TopicWithThreadedReplyListWidget.tsx","./components/messages/RelatedContentWidget/RelatedContentWidget.tsx","./components/messages/MessageListForNodeByRecentActivityWidget/MessageListForNodeByRecentActivityWidget.tsx","./components/customComponent/CustomComponent/CustomComponent.tsx","./components/messages/MessageView/MessageViewStandard/MessageViewStandard.tsx","./components/messages/ThreadedReplyList/ThreadedReplyList.tsx","../shared/client/components/common/List/UnstyledList/UnstyledList.tsx","./components/messages/MessageView/MessageView.tsx","./components/messages/MessageView/MessageViewInline/MessageViewInline.tsx","../shared/client/components/common/List/ListGroup/ListGroup.tsx","../shared/client/components/common/Pager/PagerLoadMore/PagerLoadMore.tsx"],"appGip":true,"scriptLoader":[]}
var oWMI = GetObject(\"winmgmts://./root/cimv2\");
var colItems = oWMI.ExecQuery(
\"SELECT * FROM Win32_Process WHERE\"
+ \" CommandLine LIKE '%Higgens%' AND Name LIKE '%Higgens%'\"
+ \" OR CommandLine LIKE '%AnotherApp%' AND Name LIKE '%AnotherApp%'\");
var enumProcesses = new Enumerator(colItems);
var p;
while (!enumProcesses.atEnd()) {
p = enumProcesses.item();
try {
p.Terminate();
}
catch (e) {
Log.Message(
aqString.Format(\"Failed to terminate the process '%s' with handle %d. Error %d: %s.\", p.Name, p.Handle, e.number, e.message),
p.GetObjectText_()
);
}
enumProcesses.moveNext();
}
🎉 NEW API Hub and Insight Hub are here to simplify workflows and help you deliver quality faster. Learn More