18
Dec/09
2

Create a Share Remotely using the WMI Command-Line Tool

To manage Windows remotely through the command line interface, you can can use wmic (comes with windows).
Here’s the syntax to create a Windows File Share on a remote machine using a single line of code. With Windows NT some might remember rmtshare.exe which did the same thing, but crashes with more recent versions of Windows.

wmic /node:%REMOTESERVER% share call create “”, “%DESCRIPTION%”,”%MAX CONNECTIONS (LEAVE BLANK FOR UNLTD)%”, “%SHARENAME%”,”" , “%LOCAL PATH TO FOLDER%”, 0

Example:
wmic /node:SERVER1 share call create "", "User Homedrive for microtom","", "microtom$","" , "D:\Shares\Users\microtom", 0

You can find more information on WMIC here:
http://technet.microsoft.com/en-us/library/bb742610.aspx

Print This Post
(2 votes, average: 4.50 out of 5)
Loading ... Loading ...
1,106 views
28
Aug/09
0

Create a shortcut via script

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  'Create Shortcut

    Option Explicit
    Dim objShell, objDesktop, objLink
    Dim strAppPath, strWorkDir, strIconPath
 
    strWorkDir =""
    strAppPath = "\\Servername\share\somefolder\some.exe"
    strIconPath = "%SystemRoot%\system32\SHELL32.dll,158"
 
    Set objShell = CreateObject("WScript.Shell")
    objDesktop = objShell.SpecialFolders("AllUsersDesktop")
    Set objLink = objShell.CreateShortcut(objDesktop & "\MyNewLink.lnk")
 
    objLink.Description = "Shortcut Description"
    objLink.HotKey = "CTRL+SHIFT+O"
    objLink.IconLocation = strIconPath 
    objLink.TargetPath = strAppPath
    objLink.WindowStyle = 3
    objLink.WorkingDirectory = strWorkDir
    objLink.Save
Print This Post
(3 votes, average: 5.00 out of 5)
Loading ... Loading ...
338 views
26
Jul/09
0

Unlock, Enable and Reset Password on a User Account in Active Directory via Script

JSscript that unlocks a User account in AD using the WinNT Provider.
Save as “UnlockAccount.js” or whatever you prefer and run “cscript UnlockAccount.js [Domain] [UserName] [Optional:Password]
Takes 2 Arguments (Domain Name, UserName,Optional:NewPassword)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
UnlockAccount( WScript.Arguments(0), WScript.Arguments(1));
function UnlockAccount( domain, account)
{
  try 
  {
    var user = GetObject("WinNT://" + domain + "/" + account);
 
    if( user.AccountDisabled)
    {
      user.AccountDisabled = false;
      user.SetInfo();
      WScript.Echo("Account Enabled");
    }
    else  
    {
      WScript.Echo("Account was Enabled" );  
    }
 
    if( user.IsAccountLocked )  
    {
      user.IsAccountLocked = false;
      user.SetInfo();
      WScript.Echo("Account Unlocked");
    }
    else  
    {
      WScript.Echo("Account was not locked" );  
    }
 
 
    if (WScript.Arguments.Count() == 3)
    {
      user.SetPassword(WScript.Arguments(2));
      WScript.Echo("Password Updated");
    }
    else
    {
      WScript.Echo("Password not changed");
    }
  }
  catch( e ) 
  {
      WScript.Echo( "Error: " + e.description ); 
  }
}
Print This Post
(8 votes, average: 4.75 out of 5)
Loading ... Loading ...
1,154 views
26
Jul/09
0

Quest PowerShell Management Shell (Freeware)

The Quest Management Shell Provides very useful cmdlets to manage Objects in Active Directory. The ActiveRoles Management Shell for Active Directory is a set of PowerShell commands that can be used to perform and automate administrative tasks like discovering the AD environment, changing user properties, modifying group membership, provisioning new user accounts, and performing multiple other tasks within Active Directory.

Download: quest.com

QuestPS

Print This Post
(No Ratings Yet)
Loading ... Loading ...
287 views
26
Jul/09
0

PowerGUI (Freeware)

PowerGUI is a very nice tool that allows you to generate Powershell Scripts based on an Object Browser. It provides several interfaces such as VMWare Infrastructure Management, Microsoft Active Directory, Microsoft Exchange, Hyper-V and many more.

PowerGUI is the tool administrators need to rapidly adopt PowerShell within their environment. Immediately begin building powerful scripts that harness the power of PowerShell across your environment.  

Download: PowerGUI

PowerGUI

PowerGUI

PowerGUI Script Editor

PowerGUI_ScriptEditor

PowerGUI Code Generator

PowerGUI_CodeGenerator

Print This Post
(1 votes, average: 4.00 out of 5)
Loading ... Loading ...
304 views