Here is the code I execute successfully.
Code: Select all
#TI
sCommand = 'Powershell D:\TEST\file.ps1';
ExecuteCommand(sCommand, 0);
#PS
New-Item c:\TEST\new_file.txt -type file
However, when I tried to use TI to call PowerShell to log off a user or clean user's profile on another server, it did not work!
I'm sure this code can be executed by Powershell.exe merely.
Code: Select all
#servername: XENPW55CV.woo.unatu
#username: 177684
#serverOA: 10.35.36.30
#clean user profile
(Get-WmiObject Win32_UserProfile -ComputerName XENPW55CV.woo.unatu -Filter "localpath='C:\\Users\\177684'").Delete()
#log off user
logoff ((quser /server:10.35.36.30 | Where-Object { $_ -match 177684 }) -split ' +')[2] /server:10.35.36.30
I don't know what's wrong... Is there anyone could help us or give us some direction?
Thanks so much!