Step 1: Add or Update the Script in Tanium

If you previously created a package for an earlier version of the script, you can update it with this new version. If not, here are the steps to create a new package:

  • Log in to the Tanium Console.
  • Navigate to Content > Packages.
  • Click on New Package.
  • Name or update the name of the package (e.g., “Create Custom PocScript1File”).

My sample script

param(
    [string]$Content = "hello"
)

# Create the directory if it does not exist
$directoryPath = "C:\systools"
if (-Not (Test-Path $directoryPath)) {
    New-Item -Path $directoryPath -ItemType Directory
}

# Create the file with the specified content
$filePath = "C:\systools\POCta1.txt"
$Content | Out-File -FilePath $filePath

  • On Command:
cmd.exe /c powershell.exe -ExecutionPolicy Bypass -File "PocScript1.ps1" "$1"
  • Add the PowerShell file.

Warning: Ensure the file name in the Command Line matches the name of the Downloaded File.

  • Add Parameters if necessary.
  • And Save.

Step 2: Deploy Package

  • Select the package and click “Deploy Action.”
  • You can change the parameter if you want => $1 = Info.
  • Select a Computer Group or a “Filter Question.”
  • Click on “Show Preview” to continue.
  • Click “Deploy Action.”

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.