Skip to content

Commit 5f2b959

Browse files
committed
Updated SPS_Related_Files to PowerShell_Studio_Files
1 parent 0225d02 commit 5f2b959

File tree

427 files changed

+16762
-10
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

427 files changed

+16762
-10
lines changed
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Unicode,9
2+
UTF7,9
3+
UTF8,9
4+
UTF32,9
5+
ASCII,9
6+
BigEndianUnicode,9
7+
Default,9
8+
OEM,9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<#
2+
.NOTES
3+
===========================================================================
4+
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2016 v5.2.109
5+
Created on: 2/17/2016 11:17 AM
6+
Organization: SAPIEN Technologies, Inc.
7+
Filename: GetProcess_Name.ps1
8+
===========================================================================
9+
.DESCRIPTION
10+
Save the process names for custom PrimalSense.
11+
#>
12+
13+
Get-Process | Select-Object -ExpandProperty Name -Unique > "$CustomSensePath\GetProcess_Name.csv"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<#
2+
.NOTES
3+
===========================================================================
4+
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2016 v5.2.109
5+
Created on: 2/17/2016 11:16 AM
6+
Organization: SAPIEN Technologies, Inc.
7+
Filename: GetService_Name.ps1
8+
===========================================================================
9+
.DESCRIPTION
10+
Save the service names for custom PrimalSense.
11+
#>
12+
13+
14+
Get-Service | Select-Object -ExpandProperty Name > $CustomSensePath\GetService_Name.csv
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
<#
2+
.NOTES
3+
===========================================================================
4+
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2016 v5.2.109
5+
Created on: 2/17/2016 11:17 AM
6+
Organization: SAPIEN Technologies, Inc.
7+
Filename: Network Computers.ps1
8+
===========================================================================
9+
.DESCRIPTION
10+
Save the network computer names for custom PrimalSense.
11+
#>
12+
13+
14+
#(Get-ADComputer -Filter *).name
15+
Add-Type -ReferencedAssemblies ('System.Windows.Forms') -TypeDefinition @"
16+
using System;
17+
using System.Runtime.InteropServices;
18+
using System.Security;
19+
using System.Collections;
20+
using System.Windows.Forms;
21+
using System.Collections.Specialized;
22+
using System.Collections.Generic;
23+
24+
namespace SAPIEN
25+
{
26+
public sealed class NetworkBrowser
27+
{
28+
[DllImport("Netapi32", CharSet = CharSet.Auto, SetLastError = true),
29+
SuppressUnmanagedCodeSecurityAttribute]
30+
31+
public static extern int NetServerEnum(
32+
string ServerNane, // must be null
33+
int dwLevel,
34+
ref IntPtr pBuf,
35+
int dwPrefMaxLen,
36+
out int dwEntriesRead,
37+
out int dwTotalEntries,
38+
int dwServerType,
39+
string domain, // null for login domain
40+
out int dwResumeHandle
41+
);
42+
43+
[DllImport("Netapi32", SetLastError = true),
44+
SuppressUnmanagedCodeSecurityAttribute]
45+
46+
public static extern int NetApiBufferFree(
47+
IntPtr pBuf);
48+
49+
//create a _SERVER_INFO_100 STRUCTURE
50+
[StructLayout(LayoutKind.Sequential)]
51+
public struct _SERVER_INFO_100
52+
{
53+
internal int sv100_platform_id;
54+
[MarshalAs(UnmanagedType.LPWStr)]
55+
internal string sv100_name;
56+
}
57+
58+
public NetworkBrowser()
59+
{
60+
61+
}
62+
63+
public string[] getNetworkComputers()
64+
{
65+
//local fields
66+
List<string> networkComputers = new List<string>();
67+
const int MAX_PREFERRED_LENGTH = -1;
68+
int SV_TYPE_WORKSTATION = 1;
69+
int SV_TYPE_SERVER = 2;
70+
IntPtr buffer = IntPtr.Zero;
71+
IntPtr tmpBuffer = IntPtr.Zero;
72+
int entriesRead = 0;
73+
int totalEntries = 0;
74+
int resHandle = 0;
75+
int sizeofINFO = Marshal.SizeOf(typeof(_SERVER_INFO_100));
76+
77+
78+
try
79+
{
80+
//call the DllImport : NetServerEnum with all its required parameters
81+
//see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netmgmt/netmgmt/netserverenum.asp
82+
//for full details of method signature
83+
int ret = NetServerEnum(null, 100, ref buffer, MAX_PREFERRED_LENGTH,
84+
out entriesRead,
85+
out totalEntries, SV_TYPE_WORKSTATION | SV_TYPE_SERVER, null, out
86+
resHandle);
87+
//if the returned with a NERR_Success (C++ term), =0 for C#
88+
if (ret == 0)
89+
{
90+
//loop through all SV_TYPE_WORKSTATION and SV_TYPE_SERVER PC's
91+
for (int i = 0; i < totalEntries; i++)
92+
{
93+
tmpBuffer = new IntPtr((int)buffer + (i * sizeofINFO));
94+
_SERVER_INFO_100 svrInfo = (_SERVER_INFO_100)
95+
Marshal.PtrToStructure(tmpBuffer, typeof(_SERVER_INFO_100));
96+
97+
//add the PC names to the ArrayList
98+
networkComputers.Add(svrInfo.sv100_name);
99+
}
100+
}
101+
}
102+
catch (Exception ex)
103+
{
104+
Console.Error.WriteLine("Error occurred while accessing network computers:\r\n" + ex.Message);
105+
return null;
106+
}
107+
finally
108+
{
109+
NetApiBufferFree(buffer);
110+
}
111+
//return entries found
112+
return networkComputers.ToArray();
113+
114+
}
115+
}
116+
}
117+
"@
118+
$networkBrowser = New-Object SAPIEN.NetworkBrowser
119+
$networkBrowser.getNetworkComputers() > "$CustomSensePath\Network Computers.csv"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" ?>
2+
<triggers>
3+
<trigger shortcut="ProcessNames" command="Get-Process" parameter="Name" type="cached" datafile="GetProcess_Name.csv" elevated="false" timeout="2000" scriptfile="GetProcess_Name.ps1"/>
4+
<trigger shortcut="ServiceNames" command="Get-Service" parameter="Name" type="cached" datafile="GetService_Name.csv" scriptfile="GetService_Name.ps1"/>
5+
<trigger shortcut="ComputerNames" command="*" parameter="ComputerName" type="cached" timeout="2000" datafile="Network Computers.csv" scriptfile="Network Computers.ps1"/>
6+
<trigger shortcut="functions" type="cached" datafile="functions.xml"/>
7+
</triggers>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<list>
4+
<item name="Unzipfile" image="19">
5+
<![CDATA[function Unzip-File {
6+
7+
<#
8+
.SYNOPSIS
9+
Unzip-File is a function which extracts the contents of a zip file.
10+
11+
.DESCRIPTION
12+
Unzip-File is a function which extracts the contents of a zip file specified via the -File parameter to the
13+
location specified via the -Destination parameter. This function first checks to see if the .NET Framework 4.5
14+
is installed and uses it for the unzipping process, otherwise COM is used.
15+
16+
.PARAMETER File
17+
The complete path and name of the zip file in this format: C:\zipfiles\myzipfile.zip
18+
19+
.PARAMETER Destination
20+
The destination folder to extract the contents of the zip file to. If a path is no specified, the current path
21+
is used.
22+
23+
.PARAMETER ForceCOM
24+
Switch parameter to force the use of COM for the extraction even if the .NET Framework 4.5 is present.
25+
26+
.EXAMPLE
27+
Unzip-File -File C:\zipfiles\AdventureWorks2012_Database.zip -Destination C:\databases\
28+
29+
.EXAMPLE
30+
Unzip-File -File C:\zipfiles\AdventureWorks2012_Database.zip -Destination C:\databases\ -ForceCOM
31+
32+
.EXAMPLE
33+
'C:\zipfiles\AdventureWorks2012_Database.zip' | Unzip-File
34+
35+
.EXAMPLE
36+
Get-ChildItem -Path C:\zipfiles | ForEach-Object {$_.fullname | Unzip-File -Destination C:\databases}
37+
38+
.INPUTS
39+
String
40+
41+
.OUTPUTS
42+
None
43+
44+
.NOTES
45+
Author: Mike F Robbins
46+
Website: http://mikefrobbins.com
47+
Twitter: @mikefrobbins
48+
49+
#>
50+
51+
[CmdletBinding()]
52+
param (
53+
[Parameter(Mandatory=$true,
54+
ValueFromPipeline=$true)]
55+
[ValidateScript({
56+
If ((Test-Path -Path $_ -PathType Leaf) -and ($_ -like "*.zip")) {
57+
$true
58+
}
59+
else {
60+
Throw "$_ is not a valid zip file. Enter in 'c:\folder\file.zip' format"
61+
}
62+
})]
63+
[string]$File,
64+
65+
[ValidateNotNullOrEmpty()]
66+
[ValidateScript({
67+
If (Test-Path -Path $_ -PathType Container) {
68+
$true
69+
}
70+
else {
71+
Throw "$_ is not a valid destination folder. Enter in 'c:\destination' format"
72+
}
73+
})]
74+
[string]$Destination = (Get-Location).Path,
75+
76+
[switch]$ForceCOM
77+
)
78+
79+
80+
If (-not $ForceCOM -and ($PSVersionTable.PSVersion.Major -ge 3) -and
81+
((Get-ItemProperty -Path "HKLM:\Software\Microsoft\NET Framework Setup\NDP\v4\Full" -ErrorAction SilentlyContinue).Version -like "4.5*" -or
82+
(Get-ItemProperty -Path "HKLM:\Software\Microsoft\NET Framework Setup\NDP\v4\Client" -ErrorAction SilentlyContinue).Version -like "4.5*")) {
83+
84+
Write-Verbose -Message "Attempting to Unzip $File to location $Destination using .NET 4.5"
85+
86+
try {
87+
[System.Reflection.Assembly]::LoadWithPartialName("System.IO.Compression.FileSystem") | Out-Null
88+
[System.IO.Compression.ZipFile]::ExtractToDirectory("$File", "$Destination")
89+
}
90+
catch {
91+
Write-Warning -Message "Unexpected Error. Error details: $_.Exception.Message"
92+
}
93+
94+
95+
}
96+
else {
97+
98+
Write-Verbose -Message "Attempting to Unzip $File to location $Destination using COM"
99+
100+
try {
101+
$shell = New-Object -ComObject Shell.Application
102+
$shell.Namespace($destination).copyhere(($shell.NameSpace($file)).items())
103+
}
104+
catch {
105+
Write-Warning -Message "Unexpected Error. Error details: $_.Exception.Message"
106+
}
107+
108+
}
109+
110+
}
111+
]]>
112+
</item>
113+
<item name="GetUpTime" image="19">
114+
<![CDATA[function Get-Uptime
115+
{
116+
$millisec = [Environment]::TickCount
117+
[Timespan]::FromMilliseconds($millisec)
118+
}
119+
]]>
120+
</item>
121+
<item name="FindWMIClass" image="19">
122+
<![CDATA[function Find-WMIClass
123+
{
124+
param
125+
(
126+
[Parameter(Mandatory=$true)]
127+
$SearchTerm = 'Resolution'
128+
)
129+
130+
Get-WmiObject -Class * -List |
131+
Where-Object { $_.Properties.Count -ge 3 } |
132+
Where-Object { $_.Name -notlike 'Win32_Perf*' } |
133+
Where-Object {
134+
$ListOfNames = $_.Properties | Select-Object -ExpandProperty Namea
135+
($ListOfNames -like "*$SearchTerm*") -ne $null
136+
} |
137+
Sort-Object -Property Name
138+
}
139+
]]>
140+
</item>
141+
<item name="FileOpen dialog" image="19">
142+
<![CDATA[function Show-OpenFileDialog
143+
{
144+
param
145+
(
146+
$StartFolder = [Environment]::GetFolderPath('MyDocuments'),
147+
148+
$Title = 'Open what?',
149+
150+
$Filter = 'All|*.*|Scripts|*.ps1|Texts|*.txt|Logs|*.log'
151+
)
152+
153+
154+
Add-Type -AssemblyName PresentationFramework
155+
156+
$dialog = New-Object -TypeName Microsoft.Win32.OpenFileDialog
157+
158+
159+
$dialog.Title = $Title
160+
$dialog.InitialDirectory = $StartFolder
161+
$dialog.Filter = $Filter
162+
163+
164+
$resultat = $dialog.ShowDialog()
165+
if ($resultat -eq $true)
166+
{
167+
$dialog.FileName
168+
}
169+
}
170+
]]>
171+
</item>
172+
</list>

0 commit comments

Comments
 (0)