This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Word = New-Object -ComObject Word.Application | |
$Doc = $Word.Documents.Open("$logfilepath\$logfile.docx") | |
$Name = ($Doc.FullName).replace('docx', 'pdf') | |
$Doc.SaveAs($Name, 17) | |
$Doc.Close() | |
$statusbar1.Text = "PDF has been save to C:\RSItemp\$Name" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function ConvertTo-OSCWord | |
{ | |
<# | |
.SYNOPSIS | |
ConvertTo-OSCWord is an advanced function which can be used to covert txt file to Word document file. | |
.DESCRIPTION | |
ConvertTo-OSCWord is an advanced function which can be used to covert txt file to Word document file. | |
.PARAMETER Path | |
Specifies the path of Word document. | |
.EXAMPLE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ping 127.0.0.1 -n 5 | |
MSG console /W "TEST MESSAGE" | |
ping 127.0.0.1 -n 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
New-Item -ItemType Directory -Path C:\Drivers\WIN -Force | |
Invoke-Command -ScriptBlock {Robocopy .\Thunderbolt C:\Drivers\WIN\Thunderbolt /MIR} | |
Invoke-Command -ScriptBlock {Robocopy .\Thunderbolt C:\Drivers\WIN\Thunderbolt_FW /MIR} | |
Invoke-Command -ScriptBlock {MSIEXEC /I C:\Drivers\WIN\Thunderbolt\Setup.msi /Q} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Read-Host "Make sure email list has been created before pressing enter." | |
$ver = "@vtext.com" | |
$att = "@txt.att.net" | |
$spr = "@messaging.sprintpcs.com" | |
$tmo = "@tmomail.net"` | |
#Send-MailMessage -From "s7@republicservices.com" -To "8155308515@vtext.com" -Subject "DP HDD Storage Alert" -SmtpServer "relay.repsrv.com" -Body "D-721-01 has dropped below storage threshold." | |
Send-MailMessage -From "s7@republicservices.com" -To "2193063146@txt.att.net" -Subject "DP HDD Storage Alert" -SmtpServer "relay.repsrv.com" -Body "D-721-01 has dropped below storage threshold." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-DeploymentStatusByCollection | |
{ | |
$CollectionName = Read-Host "Enter Collection Name" | |
$SiteServer = "Prodcmapp01.repsrv.com " | |
$SiteCode = "EPM" | |
$SiteDrive = $SiteCode + ":" | |
Import-Module (Join-Path -Path (($env:SMS_ADMIN_UI_PATH).Substring(0, $env:SMS_ADMIN_UI_PATH.Length - 5)) -ChildPath "\ConfigurationManager.psd1") -Force | |
if ((Get-PSDrive $SiteCode -ErrorAction SilentlyContinue | Measure-Object).Count -ne 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Export Printers | |
New-Item -ItemType Directory -Path C:\RSItemp\mystore -Force | |
Invoke-Command -scriptblock {cmd /c "C:\Windows\System32\spool\tools\Printbrm.exe /b /f C:\RSItemp\mystore\backup.printerExport"} -ComputerName <PCNAME> | |
#Import Printers | |
Invoke-Command -scriptblock {cmd /c "C:\Windows\System32\spool\tools\Printbrm.exe /r /f C:\RSItemp\mystore\backup.printerExport"} -ComputerName <PCNAME> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-CimInstance Win32_networkadapter | Where NetEnabled -eq $true | ft Name,TimeOfLastReset -auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Key = New-Object Byte[] 32 | |
[Security.Cryptography.RNGCryptoServiceProvider]::Create().GetBytes($Key) | |
$Key | out-file '\\srilcredev01\c$\RSICode\StoredCreds\aes.key' | |
$credential = Get-Credential | |
$credential.Password | ConvertFrom-SecureString -key (get-content '\\srilcredev01\c$\RSICode\StoredCreds\aes.key') | Set-Content '\\srilcredev01\c$\RSICode\StoredCreds\LogOnAsBatch.txt' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$encrypted = Get-Content '\\srilcredev01\c$\RSICode\StoredCreds\LogOnAsBatch.txt' | ConvertTo-SecureString -Key (Get-Content '\\srilcredev01\c$\RSICode\StoredCreds\aes.key') | |
$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($encrypted) | |
$UnsecurePassword = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR) | |
$Action = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument '-ExecutionPolicy Bypass -File "C:\RSItemp\RunMe.ps1"' | |
$Trigger = New-ScheduledTaskTrigger -At "07/17/2019 08:47" -Once | |
$Settings = New-ScheduledTaskSettingsSet -StartWhenAvailable | |
$Principal = New-ScheduledTaskPrincipal -UserID "repsrv\svc-sccmtask" -LogonType ServiceAccount -RunLevel Highest | |
$Password = "$UnsecurePassword" | |
$UserName = "repsrv\svc-sccmtask" | |
$Task = New-ScheduledTask -Action $Action -Trigger $Trigger -Settings $Settings -Principal $Principal |
NewerOlder