0% found this document useful (0 votes)
11 views2 pages

Remote File Management with PowerShell

This document contains several PowerShell scripts for performing remote management tasks like restarting computers, installing Windows updates, copying files, checking operating systems versions, starting the command prompt remotely, creating persistent routes, pinging IP addresses, and resolving hostnames to IP addresses.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views2 pages

Remote File Management with PowerShell

This document contains several PowerShell scripts for performing remote management tasks like restarting computers, installing Windows updates, copying files, checking operating systems versions, starting the command prompt remotely, creating persistent routes, pinging IP addresses, and resolving hostnames to IP addresses.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Powershell

Saturday, November 20, 2021


4:00 AM
------------Reiniciar computadora
remoto------------------
Shutdown /m \\namecomputer /t <segundos> /r
 
------------Setup de instalador de
windows------------------
[Link] /auto upgrade /dynamicupdate disable
/migratedrivers all /quiet /noreboot
 
 
------------scipt copiar archivos
remoto------------------
 
#remote machines list
$machines= Get-Content -Path "C:\temp\[Link]"
foreach ($onemachine in $machines)
{
Write-Host "Currently the script is copying files on"
$onemachine
Copy-Item -Path "\\[Link]\e$\ML210303098\Apps\
[Link]" -Destination "\\$onemachine\c$\" -Recurse
}
 
------------Version de windows de forma
remota------------------
 
Get-Content "C:\[Link]" | ForEach-Object{
$os_name=$null
$os_version=$null
$errorMsg=''
Try { $os_name = (Get-WmiObject Win32_OperatingSystem -
ComputerName $_ ).Caption }
 
Catch { $errorMsg=$_.[Link] }
 
if(!$os_name){ $os_name = "The machine is unavailable
$errorMsg" $os_version = "The machine is unavailable" }
 
else{ $os_version = (Get-WmiObject
Win32_OperatingSystem -ComputerName $_ ).Version }
 
New-Object -TypeName PSObject -Property @{ ComputerName
= $_ OSName = $os_name OSVersion = $os_version }
 
} | Select ComputerName,OSName,OSVersion |
Export-Csv "C:\OS_Details.csv" -NoTypeInformation -
Encoding UTF8
 
------------iniciar cmd en remota------------------
 
.\psexec \\HOSTNAME cmd
 
------------crear ruta persistente para
red------------------
 
ROUTE PRINT --Mostrar tabla de rutas.
route -p ADD [ IP ] MASK [Link] [ DEFAULTGATEWAY ]
 
-------------------------------------------------------
------
$ping=New-Object [Link]
 
1..10 | % { $[Link]("172.25.245.$_") | select address, status }
 
[[Link]]::gethostentry('[Link]')
 
$ip = "10.49.216"
var islist= 1..254 | %{if ((test-connection "10.49.216.$_" -count 1 -quiet)) {write-host -f Green "$ip`.$_"}}
if (islist){ }
 
1..50 | %{if ((test-connection "10.49.216.$_" -count 1 -quiet))
{[[Link]]::gethostentry([IPAddress]"$ip`.$_")}}
 
 
 

You might also like