@@ -9,6 +9,7 @@ So they are contained in single .ps1 files that can be installed using `Install-
9
9
---
10
10
11
11
### ConvertTo-ShortPath
12
+ Converts each element of a file object path to the 8.3 path and return the short path string.
12
13
13
14
```
14
15
PS C:\Users\dotps1\Documents\GitHub\PSFunctions\Functions> ConvertTo-ShortPath
@@ -18,7 +19,10 @@ PS C:\> Get-Item $env:WinDir\System32\WindowsPowerShell\v1.0\powershell.exe | .\
18
19
C:\Windows\System32\WINDOW~1\v1.0\powershell.exe
19
20
```
20
21
22
+ ---
23
+
21
24
### Enable-WindowsStore
25
+ Sets the registry that disables the Windows Store to "0", which will temporarily allow access to the Windows Store.
22
26
23
27
```
24
28
PS C:\> Enable-WindowsStore
@@ -30,7 +34,10 @@ PS C:\> Enable-WindowsStore -Credential (Get-Credential)
30
34
PS C:\> Get-Credential | Enable-WindowsStore
31
35
```
32
36
37
+ ---
38
+
33
39
### Find-NthIndexOf
40
+ Finds the nth index of a char in a string, returns -1 if the char does not exist, or if nth is out of range.
34
41
35
42
```
36
43
PS C:\> Find-NthIndexOf -Target "CN=me,OU=Users,DC=domain,DC=org" -Value "=" -Nth 2
@@ -41,11 +48,34 @@ PS C:\> ($dn = "CN=dotps1,OU=Users,DC=domain,DC=org").SubString((Find-NthIndexOf
41
48
OU=Users,DC=domain,DC=org
42
49
43
50
44
- PS C:\> Find-NthIndexOf -Target "Hello World." -Value "w" -IgnoreCase
51
+ PS C:\> Find-NthIndexOf -Target "Hello World." -Value "w" -IgnoreCase -Nth 1
45
52
6
46
53
```
47
54
55
+ ---
56
+
57
+ ### Get-ADComputerSiteName
58
+ Queries DNS to get the computers IPAddress then, returns the ADSiteName base on AD Sites and Services.
59
+
60
+ ```
61
+ PS C:\> Get-ADComputerSiteName
62
+
63
+ PSComputerName ADSiteName
64
+ -------------- ----------
65
+ MyComputer Default-First-Site
66
+
67
+
68
+ PS C:\> Get-ADComputer -Filter { Name -like '*Computer*' } | Get-ADComputerSiteName
69
+
70
+ PSComputerName ADSiteName
71
+ -------------- ----------
72
+ MyComputer Default-First-Site
73
+ ```
74
+
75
+ ---
76
+
48
77
### Get-ItemExtendedAttribute
78
+ Get extended item metadeta attribute value from an item using COM and referenced by attribute number.
49
79
50
80
```
51
81
PS C:\> Get-ItemExtendedAttribute -Path .\googlechromestandaloneenterprise.msi -Attribute 24
@@ -83,7 +113,10 @@ Attribute Value
83
113
247 43%
84
114
```
85
115
116
+ ---
117
+
86
118
### Get-LastLoggedOnUser
119
+ Gets the last not special user to have a loaded profile on a given system.
87
120
88
121
```
89
122
PS C:\> Get-LastLoggedOnUser
@@ -101,24 +134,10 @@ Server1 5/5/2017 9:06:45 AM domain\username True
101
134
Server1 5/5/2017 9:06:45 AM domain\username False
102
135
```
103
136
104
- ### Get-ADComputerSiteName
105
-
106
- ```
107
- PS C:\> Get-ADComputerSiteName
108
-
109
- PSComputerName ADSiteName
110
- -------------- ----------
111
- MyComputer Default-First-Site
112
-
113
-
114
- PS C:\> Get-ADComputer -Filter { Name -like '*Computer*' } | Get-ADComputerSiteName
115
-
116
- PSComputerName ADSiteName
117
- -------------- ----------
118
- MyComputer Default-First-Site
119
- ```
137
+ ---
120
138
121
139
### Get-MsiPropertyValue
140
+ Opens a Windows Installer Database (.msi) and queries for the specified property value.
122
141
123
142
```
124
143
PS C:\> Get-MsiPropertyValue -Path .\jre1.8.0_121.msi -Property ProductVersion, ProductCode
@@ -136,7 +155,10 @@ jre1.8.0_111.msi 8.0.1110.14 {26A24AE4-039D-4CA4-87B4-2F32180111F0}
136
155
jre1.8.0_121.msi 8.0.1210.13 {26A24AE4-039D-4CA4-87B4-2F32180121F0}
137
156
```
138
157
158
+ ---
159
+
139
160
### Get-ProgramUninstallString
161
+ Gets the uninstall string for a program, can be filtered to a key word of the programs display name.
140
162
141
163
```
142
164
PS C:\> Get-ProgramUninstallString -Name "Google Chrome"
@@ -154,7 +176,13 @@ Google Chrome 57.0.2987.110 {4F711ED6-6E14-3607-A3CA-E3282AFE87B6} MsiExe
154
176
Google Update Helper 1.3.32.7 {60EC980A-BDA2-4CB6-A427-B07A5498B4CA} MsiExec.exe /I{60EC980A-BDA2-4CB6-A427-B07A5498B4CA}
155
177
```
156
178
179
+ ---
180
+
157
181
### New-ADUserName
182
+ Create a new username with the following order until a unique Username is found.
183
+ 1 . First Initial Last Name.
184
+ 2 . First Initial First Middle Initial Last Name.
185
+ 3 . Iterates First Name adding each Char until a unique Username is found.
158
186
159
187
```
160
188
PS C:\> New-Username -FirstName John -LastName Doe
@@ -167,7 +195,10 @@ PS C:\> New-Username -FirstName Jane -LastName Doe -MiddleName Ala
167
195
jadoe
168
196
```
169
197
198
+ ---
199
+
170
200
### New-NetStaticIPAddress
201
+ Removes the current NetIPAddress and NetRoute on a given NetAdapter. Sets a new Static NetIPAddress and adds DNS Server values if provided.
171
202
172
203
```
173
204
PS C:\> New-NetStaticIPAddress -InterfaceIndex 3 -IPAddress 192.168.1.1 -DefaultGateway 192.168.1.0 -PrefixLength 24 -DnsServerAddress 192.168.1.0 -Confirm:$false
@@ -188,7 +219,10 @@ SkipAsSource : False
188
219
PolicyStore : ActiveStore
189
220
```
190
221
222
+ ---
223
+
191
224
### Test-Credential
225
+ Simulates an Authentication Request in a Domain environment using a PSCredential Object. Returns $true if both Username and Password pair are valid.
192
226
193
227
```
194
228
PS C:\> Test-Credential -Credential (Get-Credential)
@@ -203,7 +237,12 @@ Credential
203
237
PS C:\> Test-Credential -Credential $credential
204
238
True
205
239
```
240
+
241
+ ---
242
+
206
243
### Test-WannaCryVulnerability
244
+ Test for applicable patches to prevent the WannaCry malware. Tests for SMB1 protocol and component.
245
+
207
246
```
208
247
PS C:\> Test-WannaCryVulnerability
209
248
@@ -215,7 +254,7 @@ SMB1FeatureEnabled : False
215
254
SMB1ProtocolEnabled : False
216
255
217
256
218
- PS C:\> Get-ADComputer -Filter * -OrganizationalUnit OU=workstations,DC=domain,DC=org | Test-WannaCryVulnerability
257
+ PS C:\> Get-ADComputer -Identity workstation | Test-WannaCryVulnerability
219
258
220
259
PSComputerName : workstation
221
260
OperatingSystem : Microsoft Windows 7 Professional
0 commit comments