Friday, August 7, 2015

XenApp 6.5 published Windows Explorer using powershell

based on http://support.citrix.com/article/CTX131423

Using a Batch launcher for flexibility to run a powershell script instead of autoit.

[ExplorerLauncher.cmd]
@echo off
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -executionPolicy bypass -file "C:\Program Files\AppScripts\ExplorerLauncher.ps1"
exit

[explorerlauncher.ps1]

#$Process = [Diagnostics.Process]::Start("notepad")
$process = Start-Process notepad -WindowStyle Minimized -PassThru
$id = $Process.Id
Write-Host "Pre-Launch Process created. Process id is $id"
Write-Host "sleeping for 2 seconds"
Start-Sleep -Seconds 2
Write-Host "Loading explorer"
Start-Process "Explorer" -ArgumentList "Z:\"
Write-Host "sleeping for 2 seconds"
try {
Stop-Process -Id $id -ErrorAction stop
Write-Host "Successfully killed the process with ID: $ID"
} catch {
Write-Host "Failed to kill the process"
}
Start-Sleep -Seconds 2
Write-host "Exiting Launch completed"
exit

Saturday, August 1, 2015

windows 10 | cleanups debloat

if you dare...

follow this
- https://www.reddit.com/r/Windows10/comments/3f38ed/guide_how_to_disable_data_logging_in_w10/


my Debloat script...
Help from
- http://blogs.technet.com/b/deploymentguys/archive/2013/10/21/removing-windows-8-1-built-in-applications.aspx
- https://www.reddit.com/r/Windows10/comments/3diylq/powershell_commands_to_uninstall_unwanted_builtin/

#
# Cleans up Windows 10 Bloatware... Perform at your own risk :) !
#

$Removelist=@"
Microsoft.BingFinance                   
Microsoft.BingWeather
Microsoft.BingNews
Microsoft.Windows.Photos                
Microsoft.WindowsCamera
Microsoft.XboxApp                       
Microsoft.ZuneMusic                     
microsoft.windowscommunicationsapps
Microsoft.SkypeApp                      
Microsoft.ZuneVideo                     
Microsoft.WindowsSoundRecorder          
Microsoft.WindowsScan                   
Microsoft.WindowsReadingList            
Microsoft.WindowsPhone                  
Microsoft.WindowsMaps                   
Microsoft.Reader                        
Microsoft.People                        
Microsoft.Office.OneNote                
Microsoft.MicrosoftSolitaireCollection  
Microsoft.MicrosoftOfficeHub            
Microsoft.BingTravel                    
Microsoft.BingSports                    
Microsoft.BingHealthAndFitness          
Microsoft.BingFoodAndDrink
#Microsoft.3DBuilder
"@

$removelist=$Removelist.split("`n")

ForEach ($App in $removeList){

$app=$App.Trim()

$Packages = Get-AppxPackage | Where-Object {$_.Name -eq $App}

if ($Packages -ne $null){

Write-Host "Removing Appx Package: $App"

foreach ($Package in $Packages)

{

Remove-AppxPackage -package $Package.PackageFullName 

}

}

else

{

Write-Host "Unable to find package: $App"

}

$ProvisionedPackage = Get-AppxProvisionedPackage -online | Where-Object {$_.displayName -eq $App}

if ($ProvisionedPackage -ne $null)

{

Write-Host "Removing Appx Provisioned Package: $App"

remove-AppxProvisionedPackage -online -packagename $ProvisionedPackage.PackageName 

}

else

{

Write-Host "Unable to find provisioned package: $App"

}

}





Thursday, July 23, 2015

Powershell | Array, Element, SQL

working on extracting elements from a array then uploading into SQL

#test array
$comp = New-Object System.Object
$comp | Add-Member -type NoteProperty -name DSAType -value "xtra"
$comp | Add-Member -type NoteProperty -name Hostname  -value "Host"
$comp | Add-Member -type NoteProperty -name Fails -value "failures"

#foreach ($comp in $warrantarray){
$cl=$null
$dl=$null
($comp|gm)|where{$_.membertype -eq 'noteproperty'}|% {
$cl+=$_.Name+","
$dl+=($comp).($_.name)+","
}
$cl=$cl.Substring(0,$cl.Length-1)
$cl
$dl=$dl.Substring(0,$dl.Length-1)
$dl
# do sql stuf... but write-hosting here...

write-host "INSERT INTO $dbTable ($cl) VALUES ($dl)"

#}

also possible to this way.

http://sphints.blogspot.com.au/2014/03/powershell-write-array-of-objects-to.html

Wednesday, July 8, 2015

BBQ Linux - IPC \ PACMAN update error

Just performed my 2nd built of antergos
for some reason PACMAN was having issues. :|

ran
# dirmngr  << dev
from https://bbs.archlinux.org/viewtopic.php?id=190380

and all was working again...

Thursday, June 25, 2015

XenApp Changelog - Last 7 days




Add-PSSnapin Citrix.common.commands
$connectionstring="Data Source=lc28xensql;Initial Catalog=xencfglog;User Id=xencfgviewer;Password=xencfgviewer;Provider=SQLOLEDB;"
$timeperiodfrom=(Get-Date).AddDays(-7)
Get-CtxConfigurationLogReport -ConnectionString $connectionstring -TimePeriodFrom $timeperiodfrom | format-table -Property Date,account,tasktype,itemtype,itemname,description -AutoSize

Friday, May 15, 2015

LSPCI using WMI ( WMIC )


From Command Prompt:
Wmic path win32_pnpentity where "deviceid like '%PCI%'" get name,deviceid

with powershell:
gwmi win32_pnpentity | where{$_.deviceid -match "PCI"} | select name,deviceid

Tuesday, May 12, 2015

POWERSHELL | Comparing File ACL



#Generate the Base line acl

$TheACL=Get-Acl \\$server\$testpath\LCFSTEST\test.txt
$TheACL|Export-Clixml $logfolder\'base_'$testpath.xml

#ACTION - Modify permissions

$TheACL=Get-Acl \\$server\$testpath\LCFSTEST\test.txt

#Import the BASE ACL

$BaseACL=Import-Clixml $logfolder\'base_'$testpath.xml
If (diff $($TheACL.Access) $($BaseACL.Access) -Property Filesystemrights) { Write-Host Different Check $testpath Permissions}