Showing posts with label script. Show all posts
Showing posts with label script. Show all posts

19 September, 2010

UnLink GPO script

Hi,

All I wanted is to UnLink a GPO from an OU using a script, not a lot to ask google.
It seems that no one ever need to UnLink a GPO, only delete or link.
So I took the original DeleteGPO.wsf from the GPMC scripts directory and changed it a bit so it would not delete but only unlink the gpo.

Copy the content of the  frame to get the wsf script.



Also published it on my GoogleDocs due to the vbs.

Save it as UnLinkGPO.wsf into "C:\program files\gpmc\scripts" and you have an unlink gpo script.

Enjoy

11 May, 2010

Delete all snapshots in a SR (XenServer)

Hi,

Wrote a little script to centrally delete all snapshots from a SR on XenServer.
I noticed that although you delete a snapshot an entry still remains on the SR.
Since I have 1 main SR I wrote a script to delete all of them before the backup process begins (later when it will be ready I'll post it).

================================================
echo === deleting old snapshot ===
echo Start at:
echo %date% - %time%
:start
C:\Progra~1\Citrix\XenCenter\xe.exe -s [Pool Master / Server IP] -u [user] -pw [password] vdi-list is-a-snapshot=true sr-uuid=[sr uuid] --minimal > vdi.txt
for /f "tokens=1 delims=," %%G in (vdi.txt) do (
if [%%G] EQU [] goto end
C:\Progra~1\Citrix\XenCenter\xe.exe -s [Pool Master / Server IP] -u [user] -pw [password] vdi-destroy uuid=%%G
echo.
goto start
)

:end
=================================================

and it works great...

02 August, 2009

run script only when the user got his desktop

Hi,

I had a problem, I needed to change all the workstations screen resolution at my client network.

I found a cool small tool named ResSwitch, the problem with it that it can only run when a user has it's desktop loaded.

I added the following lines to chack if the user desktop is ready.

====================================
:check_4_explorer
tasklist find "explorer"
if %errorlevel% == 1 goto check_4_explorer

"%~dp0ResSwitch.exe" /WIDTH:1280 /HEIGHT:1024
====================================

19 May, 2009

Smart Ping when restarting

Hi,
You restart a remote server because you installed some new MS updates and you need to know when it's back online.
What we all do?, start pinging the server and continue to do other things.
when we come back after few minutes to the ping window we see that the server is online but we missed to see it's gone offline.
The following script (I called it "Smart Ping") will check the output from the ping action and look for specific word to let you know that the server went down and went up again.

Fill free to change the words it searches as you see fit in your environment.

=======================================
echo off
cls
:dead
title Server [%1] is going to shut down [%time%]...
ping -n 1 -w 300 %1 find "Request timed out."
IF %ERRORLEVEL% == 0 (goto back_alive) ELSE (goto dead)
:back_alive
title Server [%1] is down [%time%]...
ping -n 1 -w 300 %1 find "TTL"
IF %ERRORLEVEL% == 0 (goto end) ELSE (goto back_alive)
:end
title Server [%1] is Back online [%time%]...
pause
=======================================

Enjoy...