Export and Delete Expired Actions
2 Votes |
Description
Action Parameters:
<< Enter the IEM Server Operator Name
<< Enter the IEM Server Operator Password (Note: This password will be encrypted)
_____________________________________________________________________________________________________
Description:
This task will export expired actions (10 at a time) then delete the actions from the console.
Exported actions will reside in C:\Import under as <actionID>.xml
Property Details
3754 | |
QA - Ready for Production Level Testing | |
Export and Delete Expired Actions | |
BESC | |
mike.english@us.ibm.com | |
11/19/2013 12:00:00 AM | |
Export, Expired, Actions | |
menglish on 4/4/2014 8:05:48 AM | |
menglish on 4/4/2014 8:05:48 AM | |
11470 Views / 160 Downloads | |
* Average over 1 rating. ** Log In or Register to add your rating. |
Relevance
exists main gather service
Used in 3 fixlets | * Results in a true/false |
(if( name of operating system starts with "Win" ) then platform id of operating system != 3 else true) AND (if exists property "in proxy agent context" then ( not in proxy agent context ) else true )
version of client >= "9.0"
Actions
Action 1 (default)
Action Link Click
here to deploy this action.
Script Type
BigFix Action Script
//Check for C:\Import
if {not exist folder "c:\import"}
dos mkdir "c:\import"
endif
delete "c:\IMPORT\expiredactionIDs.xml"
delete "c:\import\expiredActionTuple.txt"
delete __appendfile
//login to API and obtain all expired action IDs
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} login -q --server=localhost --user={parameter "RemoteOP" of action} --password={parameter "RemoteOPPass" of action}
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} get query --relevance "(concatenation %%22, %%22 of (ids of bes actions whose (state of it = %%22Expired%%22)as string))" > c:\import\expiredactionIDs.xml
delete api.bat
copy __appendfile api.bat
waithidden api.bat
//Strip XML
delete __appendfile
appendfile {following text of first ">" of (preceding text of first "" of (lines of file "c:\import\expiredactionIDs.xml"))}
move __appendfile "c:\import\expiredActionTuple.txt"
delete "c:\IMPORT\result.xml"
delete "c:\import\expiredactions.xml"
//verify that tuple exists
if {exists tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredActionTuple.txt" as string))}
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} login -q --server=localhost --user={parameter "RemoteOP" of action} --password={parameter "RemoteOPPass" of action}
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} get action/{tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredactiontuple.txt" as string))} > c:\import\{tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredactiontuple.txt" as string))}.xml
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} delete action/{tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredactiontuple.txt" as string))}
delete api.bat
copy __appendfile api.bat
waithidden api.bat
delete __appendfile
if {exists tuple string item 1 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredActionTuple.txt" as string))}
appendfile {following text of first ", " of lines of file "c:\import\expiredactiontuple.txt"}
delete "c:\import\expiredActionTuple.txt"
move __appendfile "c:\import\expiredActionTuple.txt"
delete __appendfile
endif
endif
//verify that tuple exists
if {exists tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredActionTuple.txt" as string))}
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} login -q --server=localhost --user={parameter "RemoteOP" of action} --password={parameter "RemoteOPPass" of action}
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} get action/{tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredactiontuple.txt" as string))} > c:\import\{tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredactiontuple.txt" as string))}.xml
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} delete action/{tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredactiontuple.txt" as string))}
delete api.bat
copy __appendfile api.bat
waithidden api.bat
delete __appendfile
if {exists tuple string item 1 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredActionTuple.txt" as string))}
appendfile {following text of first ", " of lines of file "c:\import\expiredactiontuple.txt"}
delete "c:\import\expiredActionTuple.txt"
move __appendfile "c:\import\expiredActionTuple.txt"
delete __appendfile
endif
endif
//verify that tuple exists
if {exists tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredActionTuple.txt" as string))}
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} login -q --server=localhost --user={parameter "RemoteOP" of action} --password={parameter "RemoteOPPass" of action}
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} get action/{tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredactiontuple.txt" as string))} > c:\import\{tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredactiontuple.txt" as string))}.xml
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} delete action/{tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredactiontuple.txt" as string))}
delete api.bat
copy __appendfile api.bat
waithidden api.bat
delete __appendfile
if {exists tuple string item 1 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredActionTuple.txt" as string))}
appendfile {following text of first ", " of lines of file "c:\import\expiredactiontuple.txt"}
delete "c:\import\expiredActionTuple.txt"
move __appendfile "c:\import\expiredActionTuple.txt"
delete __appendfile
endif
endif
//verify that tuple exists
if {exists tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredActionTuple.txt" as string))}
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} login -q --server=localhost --user={parameter "RemoteOP" of action} --password={parameter "RemoteOPPass" of action}
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} get action/{tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredactiontuple.txt" as string))} > c:\import\{tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredactiontuple.txt" as string))}.xml
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} delete action/{tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredactiontuple.txt" as string))}
delete api.bat
copy __appendfile api.bat
waithidden api.bat
delete __appendfile
if {exists tuple string item 1 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredActionTuple.txt" as string))}
appendfile {following text of first ", " of lines of file "c:\import\expiredactiontuple.txt"}
delete "c:\import\expiredActionTuple.txt"
move __appendfile "c:\import\expiredActionTuple.txt"
delete __appendfile
endif
endif
//verify that tuple exists
if {exists tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredActionTuple.txt" as string))}
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} login -q --server=localhost --user={parameter "RemoteOP" of action} --password={parameter "RemoteOPPass" of action}
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} get action/{tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredactiontuple.txt" as string))} > c:\import\{tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredactiontuple.txt" as string))}.xml
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} delete action/{tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredactiontuple.txt" as string))}
delete api.bat
copy __appendfile api.bat
waithidden api.bat
delete __appendfile
if {exists tuple string item 1 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredActionTuple.txt" as string))}
appendfile {following text of first ", " of lines of file "c:\import\expiredactiontuple.txt"}
delete "c:\import\expiredActionTuple.txt"
move __appendfile "c:\import\expiredActionTuple.txt"
delete __appendfile
endif
endif
//verify that tuple exists
if {exists tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredActionTuple.txt" as string))}
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} login -q --server=localhost --user={parameter "RemoteOP" of action} --password={parameter "RemoteOPPass" of action}
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} get action/{tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredactiontuple.txt" as string))} > c:\import\{tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredactiontuple.txt" as string))}.xml
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} delete action/{tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredactiontuple.txt" as string))}
delete api.bat
copy __appendfile api.bat
waithidden api.bat
delete __appendfile
if {exists tuple string item 1 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredActionTuple.txt" as string))}
appendfile {following text of first ", " of lines of file "c:\import\expiredactiontuple.txt"}
delete "c:\import\expiredActionTuple.txt"
move __appendfile "c:\import\expiredActionTuple.txt"
delete __appendfile
endif
endif
//verify that tuple exists
if {exists tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredActionTuple.txt" as string))}
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} login -q --server=localhost --user={parameter "RemoteOP" of action} --password={parameter "RemoteOPPass" of action}
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} get action/{tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredactiontuple.txt" as string))} > c:\import\{tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredactiontuple.txt" as string))}.xml
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} delete action/{tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredactiontuple.txt" as string))}
delete api.bat
copy __appendfile api.bat
waithidden api.bat
delete __appendfile
if {exists tuple string item 1 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredActionTuple.txt" as string))}
appendfile {following text of first ", " of lines of file "c:\import\expiredactiontuple.txt"}
delete "c:\import\expiredActionTuple.txt"
move __appendfile "c:\import\expiredActionTuple.txt"
delete __appendfile
endif
endif
//verify that tuple exists
if {exists tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredActionTuple.txt" as string))}
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} login -q --server=localhost --user={parameter "RemoteOP" of action} --password={parameter "RemoteOPPass" of action}
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} get action/{tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredactiontuple.txt" as string))} > c:\import\{tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredactiontuple.txt" as string))}.xml
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} delete action/{tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredactiontuple.txt" as string))}
delete api.bat
copy __appendfile api.bat
waithidden api.bat
delete __appendfile
if {exists tuple string item 1 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredActionTuple.txt" as string))}
appendfile {following text of first ", " of lines of file "c:\import\expiredactiontuple.txt"}
delete "c:\import\expiredActionTuple.txt"
move __appendfile "c:\import\expiredActionTuple.txt"
delete __appendfile
endif
endif
//verify that tuple exists
if {exists tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredActionTuple.txt" as string))}
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} login -q --server=localhost --user={parameter "RemoteOP" of action} --password={parameter "RemoteOPPass" of action}
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} get action/{tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredactiontuple.txt" as string))} > c:\import\{tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredactiontuple.txt" as string))}.xml
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} delete action/{tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredactiontuple.txt" as string))}
delete api.bat
copy __appendfile api.bat
waithidden api.bat
delete __appendfile
if {exists tuple string item 1 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredActionTuple.txt" as string))}
appendfile {following text of first ", " of lines of file "c:\import\expiredactiontuple.txt"}
delete "c:\import\expiredActionTuple.txt"
move __appendfile "c:\import\expiredActionTuple.txt"
delete __appendfile
endif
endif
//verify that tuple exists
if {exists tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredActionTuple.txt" as string))}
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} login -q --server=localhost --user={parameter "RemoteOP" of action} --password={parameter "RemoteOPPass" of action}
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} get action/{tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredactiontuple.txt" as string))} > c:\import\{tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredactiontuple.txt" as string))}.xml
appendfile {preceding text of last "\" of (expand environment string of (image path of service "FILLDB")) & "\iem.exe%22"} delete action/{tuple string item 0 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredactiontuple.txt" as string))}
delete api.bat
copy __appendfile api.bat
waithidden api.bat
delete __appendfile
if {exists tuple string item 1 of (concatenation ", " of (substrings separated by ", " of lines of file "c:\import\expiredActionTuple.txt" as string))}
appendfile {following text of first ", " of lines of file "c:\import\expiredactiontuple.txt"}
delete "c:\import\expiredActionTuple.txt"
move __appendfile "c:\import\expiredActionTuple.txt"
delete __appendfile
endif
endif
Success Criteria
This action will be considered successful when the applicability relevance evaluates to false.
Sharing
Social Media: |
Comments
|
|
to save the expired actions for auditing I guess? |
|
|
If re-imported actions lack the original target/endpoints and actual result history and are potentially active against multiple endpoints when imported - why save them? Other than seeing the action script there doesn't seem to be any value to keeping them? |
|
|
Can you please help us with what would be the expected result from below relevance {following text of first ">" of (preceding text of first "" of (lines of file "c:\import\expiredactionIDs.xml"))} |