Create a folder on the root of your C: drive. I named miune Cleanup_Hyberfil. In that folder put, Psexec.exe, Psinfo.exe and a txt file name COMPUTERS.TXT that has the computers you want to target. Make a batch file in the same folder with the following content:
PSEXEC @COMPUTERS.TXT -u domain\username -p {password} -d -e -h %WINDIR%\SYSTEM32\NET.EXE user Administrator {password}
psinfo -d Free @COMPUTERS.TXT -u localhost\Administrator -p {password}
psexec @COMPUTERS.TXT -u Administrator -p {password} %windir%\system32\powercfg /H OFF
psinfo -d Free @COMPUTERS.TXT -u localhost\Administrator -p {password}
PAUSE
Crypto Prices
Friday, September 14, 2012
Tuesday, September 11, 2012
Change screen resolution remotely on multiple computers
Download ResSwitch from:
http://www.naughter.com/qres.html
Put into a folder on the root of C: with PSexec. Put target computers in a text file named COMPUTERS.txt. Create a batch file with the following content, (edit according to the desired resolution):
psexec @COMPUTERS.TXT -u domain\username -p password -c -d -e -f -i %cd%\ResSwitch.exe /WIDTH:1280 /HEIGHT:1024 /DEPTH:32 /UPDATEREGISTRY /GLOBAL /RESETpause
http://www.naughter.com/qres.html
Put into a folder on the root of C: with PSexec. Put target computers in a text file named COMPUTERS.txt. Create a batch file with the following content, (edit according to the desired resolution):
psexec @COMPUTERS.TXT -u domain\username -p password -c -d -e -f -i %cd%\ResSwitch.exe /WIDTH:1280 /HEIGHT:1024 /DEPTH:32 /UPDATEREGISTRY /GLOBAL /RESETpause
Thursday, July 19, 2012
Retrieve the uptime for multiple computers
Download uptime.exe from Microsoft:
Place psexec.exe, COMPUTERS.txt, and uptime.exe in the same folder.
psexec @COMPUTERS.TXT -u domain\username -p password -c -e -f uptime.exe >> C:\uptime.txt
Will output the uptime for each machine to C:\uptime.txt on your local machine.
Place psexec.exe, COMPUTERS.txt, and uptime.exe in the same folder.
psexec @COMPUTERS.TXT -u domain\username -p password -c -e -f uptime.exe >> C:\uptime.txt
Will output the uptime for each machine to C:\uptime.txt on your local machine.
Monday, July 16, 2012
Create vSphere client shortcuts to vCenters that save your username and password
Properties of the shortcut:
Target:
"C:\Program Files\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe" -i yes -s vCenterServerNameHere -u domain\username -p password
Start in:
"C:\Program Files\VMware\Infrastructure\Virtual Infrastructure Client\Launcher"
Target:
"C:\Program Files\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe" -i yes -s vCenterServerNameHere -u domain\username -p password
Start in:
"C:\Program Files\VMware\Infrastructure\Virtual Infrastructure Client\Launcher"
Get list of IP Addresses for mutliple computers at once
REM Saves as PingEM.bat in C:\PingMachines\
REM Exports IP Addresses to C:\PingMachines\IP_Adresses.txt
@echo off
set fnm=%CD%\computers.txt
set lnm=%CD%\IP_Adresses.txt
if exist %fnm% goto Label1
echo.
echo Cannot find %fnm%
echo.
Pause
goto :eof
:Label1
echo PingTest STARTED on %date% at %time% > %lnm%
echo ================================================= >> %lnm%
echo.
for /f %%i in (%fnm%) do call :Sub %%i
echo.
echo ================================================= >> %lnm%
echo PingTest ENDED on %date% at %time% >> %lnm%
echo ... now exiting
goto :eof
:Sub
rem echo Testing %1
set state=alive
if errorlevel 1 set state=dead
echo %1 is %state%
ping -n 1 %1 >> %lnm%
REM Exports IP Addresses to C:\PingMachines\IP_Adresses.txt
@echo off
set fnm=%CD%\computers.txt
set lnm=%CD%\IP_Adresses.txt
if exist %fnm% goto Label1
echo.
echo Cannot find %fnm%
echo.
Pause
goto :eof
:Label1
echo PingTest STARTED on %date% at %time% > %lnm%
echo ================================================= >> %lnm%
echo.
for /f %%i in (%fnm%) do call :Sub %%i
echo.
echo ================================================= >> %lnm%
echo PingTest ENDED on %date% at %time% >> %lnm%
echo ... now exiting
goto :eof
:Sub
rem echo Testing %1
set state=alive
if errorlevel 1 set state=dead
echo %1 is %state%
ping -n 1 %1 >> %lnm%
Get the VMWare UUID's for multiple VM's in a .CSV file
# Save as GetUUIDs.ps1
$vc = Read-Host "Please specify your VirtualCenter"
Connect-VIServer $vc
CLS
'Beginning Script'
'Loading Snapins'
function LoadSnapin{
param($PSSnapinName)
if (!(Get-PSSnapin | where {$_.Name -eq $PSSnapinName})){
Add-pssnapin -name $PSSnapinName
}
}
LoadSnapin -PSSnapinName "VMware.VimAutomation.Core"
'Reading CSV file'
$vms = Import-CSV C:\Temp\GetUUIDs\computers.csv
$Tasks = @()
'Reading the contents of the CSV, and for each line execute the following code'
foreach ($vm in $vms){
# 'Declaring variables that correspond to the column names in the CSV'
$VMName = $vm.name
echo $VMName
Get-VM -name $VMName | %{(Get-View $_.Id).config.uuid}
}
Disconnect-VIServer $vc
Export a local group from a remote Windows computer
Example:
psexec \\computername -u domain\username net localgroup "Remote Desktop Users" > C:\rdpusers.txt
Gives you the list of RDP users from a remote computer.
psexec \\computername -u domain\username net localgroup "Remote Desktop Users" > C:\rdpusers.txt
Gives you the list of RDP users from a remote computer.
Subscribe to:
Posts (Atom)