Archive for September, 2009

While trying to create this script I came across a ton of help, Thanks online community’s!!

Download file here

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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
 
# Execute a SQL File Begin
function Execute-SqlFile($file, [string]$Server, [string]$dbName, [hashtable]$variables, [switch]$WindowsAuthentication=$true, [string]$Username, [string]$Password) {
$batch = (join-Path (cat env:TEMP) "exec_sql.bat")
write-Host Connecting to $Server</code>
 
$output = (join-Path $env:TEMP "output_sql.txt")
if (test-Path $batch) {
Remove-Item $batch -force
}
$data = ""
if (test-Path $batch) { Remove-Item $batch }
$data += "sqlcmd -S $Server"
 
if ($WindowsAuthentication) {
$data += ' -E'
} else {
$data += " -U $Username -P $Password"
}
if ($dbname) {
$data += " -d $dbName"
}
 
if ($variables -and $variables.Count -gt 0) {
$data += ' -v '
$isFirst = $true
foreach($key in $variables.keys) {
 
if (! $isFirst) { $data += ' ' } else { $isFirst=$false }
 
$val = $variables[$key]
$data += "$key="
$data += "`"$val`""
 
}
}
$data += " -i `"$file`""
 
$data += " -o `"$output`""
 
$data | Add-Content $batch -force
 
cmd /c (Resolve-Path $batch)
 
gc $output
 
}
 
 
# Allows for a Pause Begin
function Pause ($Message="Press any key to continue...")
{
Write-Host -NoNewLine $Message
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
Write-Host ""
}
 
 
# Sets Variables By Asking The Users a Question Begin
$Yourfirstname = Read-Host "What is Your First Name? 5 characters Max "
$yourrandomnumber = Read-Host "Random Number? Two Digits Max"
 
 
# Hard Coded Variables Begin
$aspen = "aspen-"
$dash = "-"
$computer = "."
 
 
# Rename Computer EX: aspen-john-1  Begin
$computerobject = (gwmi -Class Win32_ComputerSystem -Namespace "root\cimv2" -ComputerName $computer)
$computerobject.rename("$aspen$Yourfirstname$dash$yourrandomnumber")
 
 
# Get the Conputers Name Begin
$comp = get-wmiobject Win32_ComputerSystem
 
 
# Joings Computer to the Doamin Begin
# ("%DomainName%","%Username'sPassword%","%DomainName\Username%",$null,3)
$comp.JoinDomainOrWorkGroup("%%%%%","%%%%%","%%%%",$null,3)
 
 
# Calls another PowerShell Script To Set Permission Begin
# ./SetFolderPermission.ps1 -Access %Username% -Permission %PermisionLevel%
./SetFolderPermission.ps1 -Access %DomainName%\%Username% -Permission FullControl
 
 
# Hard Coded Variables Begin
$domain = "%DomainName%"
$strComputer = gc env:computername
 
 
# Sets Variables By Asking The Users a Question Begin
$username = Read-Host "What is Your Aspenware domain username without the %DomainName%\"
 
 
# Adds User to Aministrators Group Begin
$computer = [ADSI]("WinNT://" + $strComputer + ",computer")
$computer.name
$Group = $computer.psbase.children.find("administrators")
$Group.name
$Group.Add("WinNT://" + $domain + "/" + $username)
 
 
# Adds User to IIS_WPG Group Begin
$domain = "%DomainName%"
$strComputer = gc env:computername
$username = "svcnj"
$computer = [ADSI]("WinNT://" + $strComputer + ",computer")
$computer.name
$Group = $computer.psbase.children.find("IIS_WPG")
$Group.name
$Group.Add("WinNT://" + $domain + "/" + $username)
 
 
# Executes a SQL Script to add User Account to the SQL Server with SYSAdmin  Begin
Execute-Sqlfile "C:\Documents and Settings\Administrator\svcnjsql.sql" $computer.name
 
 
# Pause Then Reboots the Server Begin
pause
$reboot = (gwmi -Class Win32_OperatingSystem)
$reboot.psbase.scope.options.enableprivileges = $true
$reboot.reboot()
  • Share/Bookmark

Posted by Isaac Blum at 29 September 2009

Category: Business, Free Help, Microsoft, PowerShell

Tags: , ,

Steps Below.

1. Click Start and select Server Manager.

2. When the Server Manager window appears, go to the left pane and select Features.

3. On the right, click the Add Features link.

4. Scroll down the list and check the Windows PowerShell checkbox.

5. Click Next.

6. Click Install.

7. When the installation is complete, Windows should display that the installation succeeded.

8. Click Close.

9. Close the Server Manager.

10. To open PowerShell, go to the Start Menu, click All Programs and expand the Windows PowerShell 1.0 folder to get to the shortcut to Windows PowerShell.

  • Share/Bookmark

Posted by Isaac Blum at 29 September 2009

Category: AntiVirus, Business, For The Greater Good, Microsoft

Tags: , ,

http://www.microsoft.com/security_essentials/

Operating System: Genuine Windows XP (Service Pack 2 or Service Pack 3); Windows Vista (Gold, Service Pack 1, or Service Pack 2); Windows 7

  • Share/Bookmark
  • Archives

  • Pages

  • Tags

  • More

Get Adobe Flash playerPlugin by wpburn.com wordpress themes