Skip to content

Commit f12933d

Browse files
committed
finished powershell
1 parent 728cd27 commit f12933d

4 files changed

Lines changed: 69 additions & 1 deletion

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
<#
3+
https://www.siteground.com/kb/google_free_smtp_server/
4+
Outgoing Mail (SMTP) Server: smtp.gmail.com
5+
Use Authentication: Yes
6+
Use Secure Connection: Yes (TLS or SSL depending on your mail client/website SMTP plugin)
7+
Username: your Gmail account (e.g. user@gmail.com)
8+
Password: your Gmail password
9+
Port: 465 (SSL required) or 587 (TLS required)
10+
#>
11+
12+
Send-MailMessage -From 'knox.hutchinson@cbtnuggets.com'`
13+
-To 'knox@knoxsdata.com' `
14+
-Subject 'Data Knox YouTube Channel' `
15+
-Body "Go check it out - https://youtube.com/c/Dataknox" `
16+
-Attachments .\data.csv `
17+
-Priority High `
18+
-DeliveryNotificationOption OnSuccess, OnFailure `
19+
-SmtpServer 'smtp.gmail.com' `
20+
-Port 587 `
21+
-UseSsl `
22+
-Credential (Get-Credential)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#Block your process
2+
$i = 1
3+
while ($True) {
4+
$i++
5+
$i
6+
Start-Sleep 5
7+
}
8+
# Start a job
9+
Start-Job -ScriptBlock {
10+
$i = 1
11+
while ($True) {
12+
$i++
13+
$i
14+
Start-Sleep 5
15+
}
16+
}
17+
# Details
18+
Get-Job Job1
19+
Receive-Job Job1
20+
Stop-Job Job1
21+
#Job parameter
22+
Invoke-Command dc-nug { Get-Service } -AsJob
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Enable-PSRemoting
2+
3+
#Remotely enter a computer
4+
Enter-PSSession
5+
Get-Service
6+
Exit-PSSession
7+
8+
#Run commands remotely
9+
Invoke-Command dc-nug { Get-Service }
10+
11+
#Run GP Updates
12+
Invoke-GPUpdate dc-nug
13+
Get-ADComputer -Filter * | ForEach-Object { Invoke-GpUpdate -Computer $_.name -Force }
14+
15+
##### LINUX
16+
<#
17+
sudo apt install openssh-client
18+
sudo apt install openssh-server
19+
nano /etc/ssh/sshd_config
20+
Subsystem powershell /usr/bin/pwsh -sshs -NoLogo -NoProfile
21+
sudo service sshd restart
22+
23+
Enter-PSSession -HostName lnx-nug -UserName nuguser
24+
#>

Powershell/Powershell7/RealWorld/jsonsql.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ if ($s -eq 200) {
1111

1212
$queryPoke = @"
1313
INSERT INTO dbo.Pokemon (Id,Name,Height,Weight)
14-
VALUES ($($pokemon.Id),$($pokemon.Name),$($pokemon.Height),$($pokemon.Weight),$(If($pokemon.is_default -eq $True){1}else{0}))
14+
VALUES ($($pokemon.Id),'$($pokemon.Name)',$($pokemon.Height),$($pokemon.Weight),$(If($pokemon.is_default -eq $True){1}else{0}))
1515
"@
1616
$queryPoke
1717

0 commit comments

Comments
 (0)