Tuesday, June 21, 2016

Diskstation SSH

Turn off blue light:

su -s
[password]
echo 6 >/dev/ttyS1

Friday, June 03, 2016

OSD - Microsoft Surfaces

Found this. Lots of interesting Task Sequence customisations for Surface deployments, some of which are still relevant for Win 10 OSD.

http://download.microsoft.com/download/4/4/0/4407548E-ECE0-43C2-8EE1-13544CFC591B%2Fsurface-devices-in-the-enterprise-OS-deployment-with-SCCM-2012.pdf

SQL Query to Join Results via ResourceID

SELECT 
a.[ResourceID],
a.FileName,
a.FileVersion,
a.FilePath,
b.Distinguished_Name0
FROM [CM_DBxx].[dbo].[v_GS_SoftwareFile] a
JOIN [CM_DBxx].[dbo].[v_R_System] b on a.[ResourceID]=b.[ResourceID]
WHERE a.FileName = 'application.exe'

or..get even more information

Select 
sf.ResourceID,
sf. FilePath,
sf.FileVersion,
sf.CreationDate,
sf.FileCount,
sf.FileDescription,
sf.FileModifiedDate,
sf.FileSize,
sf.ProductId,
sf.ResourceID,
b.Name0,
b.Last_Logon_Timestamp0,
b.User_Name0,
b.Creation_Date0

from v_gs_softwarefile sf
join v_R_System b on sf.ResourceID=b.resourceID

where sf.FileName = 'acrord32.exe'

Using Powershell and WinSCP to SFTP upload

There may be an occasion where you need to send your files somewhere using SFTP. Perhaps as an automated, scheduled task:

It is not necessary to install the full WinSCP application stack. The automation pack should be used for automation. Download WinSCP automation from .NET assembly / COM library on the https://winscp.net/eng/download.php page and place on the server.

This pack contains an executable and the DLL that interact with each other. Just put the DLL and EXE together.

Script:

[System.Reflection.Assembly]::LoadFrom('C:\PATH\WinSCPnet.dll')
Add-Type -Path "C:\PATH\WinSCPnet.dll"
$sessionOptions = New-Object WinSCP.SessionOptions
$sessionOptions.ParseUrl("sftp://USER:PASS@;fingerprint=FINGERPRINT@SFTP.SITE.COM")
$session = New-Object WinSCP.Session
$session.Open($sessionOptions)
$session.PutFiles("C:\PATHTOUPLOAD\[file.xyz] or [* for all]", "/[upload folder if necessary]/").Check()
$session.Dispose()

If you downloaded the files, make sure you unblock:



Now, simply configure your Scheduled Task. Don't forget to set the Security Options.



Program/Script:                        powershell.exe
Add arguments (optional):        -ExecutionPolicy Bypass -File "C:\PathToYour\File.ps1"