I have an issue while attempting to unpin items from the taskbar on 2008 R2 servers. I believe the issue is related to the kix executable running as a 32-bit process. An "identical" script in vbscript works successfully when run as a 64-bit process, but not as a 32-bit process. If I echo all of the "verbs" available, "Pin to Taskbar" is available instead of "Unpin from Taskbar." This is true for either script running in 32 bits. Only when the vbscript is run in 64 bits is the "verb" to unpin available.

Here are some examples trying to unpin powershell. The kix version does not work (due to the "verb" "Unpin from Taskbar" not being there), and if I call the vbscript from kix (making it run in 32-bits) the result is exactly the same. Running the vbscript natively works fine (in 64-bits).

In Kix:
 Code:
$objApp = CreateObject("Shell.Application")
$objFSO = CreateObject("Scripting.FileSystemObject")
 
UnPin("C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe")
 
;************************Start of UnPin()
Function UnPin($SourceFileNameAndPath)
	;Unpins from the taskbar the program who's sources is provided
	;Syntax:	UnPin(<full path of shortcut's target>)
	;Example:	UnPin("C:\Windows\explorer.exe") ;Unpin explorer from the taskbar
	$ParentFolder = Left($SourceFileNameAndPath,InStrRev($SourceFileNameAndPath,"\") - 1)
	$Filename = Right($SourceFileNameAndPath,Len($SourceFileNameAndPath) - InStrRev($SourceFileNameAndPath,"\"))
	If $objFSO.FileExists($SourceFileNameAndPath)
	    $objFolder = $objApp.Namespace($ParentFolder)
	    $objFolderItem = $objFolder.ParseName($Filename)
	    $colVerbs = $objFolderItem.Verbs
	    For Each $objVerb in $colVerbs
		If Replace($objVerb.name,"&","") = "Unpin from Taskbar"
			$objVerb.DoIt
		EndIf
	    Next
	EndIf
EndFunction;<==UnPin()
;************************End of UnPin()


In vbscript:
 Code:
Public objApp, objFSO
Set objApp = CreateObject("Shell.Application")
Set objFSO = CreateObject("Scripting.FileSystemObject")
 
UnPin("C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe")

'************************Start of UnPin()
Function UnPin(SourceFileNameAndPath)
	'Unpins from the taskbar the program who's sources is provided
	'Syntax:	UnPin(<full path of shortcut's target>)
	'Example:	UnPin("C:\Windows\explorer.exe") 'Unpin explorer from the taskbar
	ParentFolder = Left(SourceFileNameAndPath,InStrRev(SourceFileNameAndPath,"\") - 1)
	Filename = Right(SourceFileNameAndPath,Len(SourceFileNameAndPath) - InStrRev(SourceFileNameAndPath,"\"))
	If objFSO.FileExists(SourceFileNameAndPath) Then
	    Set objFolder = objApp.Namespace(ParentFolder)
	    Set objFolderItem = objFolder.ParseName(Filename)
	    Set colVerbs = objFolderItem.Verbs
	    For Each objVerb in colVerbs
		If Replace(objVerb.name,"&","") = "Unpin from Taskbar" Then
			objVerb.DoIt
		End If
	    Next
	End If
End Function'<==UnPin()
'************************End of UnPin()