VMware Vsphere 6.0 Host Client 6.0 beta
If you get this error running the Host Client:
uncaught node.js Error
Error: EPERM, open 'c:\Program Files\VMware\HostClient\server\logs\VMware_Hostclient_logs.txt'
Run the client as an administrator
These are just random notes and programs that may have incomplete descriptions. Any scripts or programs use at your risk
Tuesday, July 8, 2014
Thursday, February 13, 2014
Powershell: Get All AD Group Members
Purpose: This script requires the RSAT tools to work. It connects to AD and gets all groups and users within each group and outputs to a csv file. It can also get single groups and display/exports the results.
###################################
#Tony Unger - Get Group members
#12/12/2013
#1.0
###################################
Import-Module activedirectory
do {
cls
$response = "N"
$ExportPath = "c:\temp\AD_GroupMemberofQuery.csv"
$myCol = @()
[int]$xMenuChoiceA = 0
while ( $xMenuChoiceA -lt 1 -or $xMenuChoiceA -gt 4 ){
Write-host "Active Directory Group Member Reporting" -foregroundcolor "magenta"
Write-host "1. Specifiy a Group"
Write-host "2. All Groups"
Write-host "3. Quit and exit"
[Int]$xMenuChoiceA = read-host "Please enter an option 1 to 3..." }
Switch( $xMenuChoiceA ){
1{$ADGroups = read-host "Please enter the AD group name:"}
2{$ADGroups = Get-ADGroup -filter {GroupCategory -eq "Security" -and GroupScope -eq "Global"} | Select -expand SamAccountName}
3{exit}
default{exit}
}
$i = 0
foreach ($ADGroup in $ADGroups){
$i++
Write-Progress -Activity "Gathering members" -status "Currently on group $ADGroup" -percentComplete ($i / $ADGroups.count*100)
$Members = get-adgroupmember $ADGroup -recursive
foreach ($MemberofGroup in $Members){
$Detail = New-Object PSObject
$Detail | Add-Member Noteproperty GroupName $ADGroup
$Detail | Add-Member Noteproperty User $MemberofGroup.Name
$Detail | Add-Member Noteproperty Account_Name $MemberofGroup.SamAccountName
$myCol += $Detail
}
}
$myCol | Export-Csv -Path $ExportPath -notype
Write-Host "File exported to: $ExportPath"
[int]$xMenuChoiceB = 0
while ( $xMenuChoiceB -lt 1 -or $xMenuChoiceA -gt 4 ){
cls
Write-host "Active Directory Group Member Reporting" -foregroundcolor "magenta"
Write-host "1. Display current results"
Write-host "2. Query another group"
Write-host "3. Quit and exit"
[Int]$xMenuChoiceB = read-host "Please enter an option 1 to 3..." }
Switch( $xMenuChoiceB ){
1{$myCol}
2{$response = "Y"}
3{exit}
default{exit}
}
}
while ($response -eq "Y")
Monday, October 14, 2013
Powershell: Add NFS Exports to ESXi Hosts
Purpose: Batch add all NFS exports to all ESXi hosts listed in $HostsToAddNFS variable.
#Add all ESXi Hosts names
$HostsToAddNFS = "hostname1","hostname2"
foreach ($Current_Host in $HostsToAddNFS )
{
connect-viserver $Current_Host
#add all NFS exports here
New-Datastore -Nfs -Name Volume1 -Path "/vol/volume1" -NfsHost x.x.x.x
New-Datastore -Nfs -Name Volume2 -Path "/vol/volume2" -NfsHost x.x.x.x
}
Monday, October 7, 2013
VMware: Change Load Balance Policy to IP Hash on ESXi Host Console
This command changes the vSwitch Load Balance Policy to iphash
esxcli network vswitch standard policy failover set -l iphash -v vSwitch0
This command changes the Port Group Management Network Load Balance Policy iphash
esxcli network vswitch standard portgroup policy failover set -p "Management Network" -l iphash
esxcli network vswitch standard policy failover set -l iphash -v vSwitch0
This command changes the Port Group Management Network Load Balance Policy iphash
esxcli network vswitch standard portgroup policy failover set -p "Management Network" -l iphash
Thursday, May 30, 2013
Vmware - VSA 5.1 Requirements
Hardware Requirements for vCenter Server in a VSA Cluster
Hardware Requirements for ESXi in a VSA Cluster
Software Configuration
required for ESXi in a VSA Cluster
Network Switch requirement
IP Address Requirements for a VSA Cluster
Wednesday, May 29, 2013
Batch - Get time from remote server write to csv audit log
Purpose: needed a hacked up batch file that was able to read time from a remote server and log to a CSV for user logon auditing. They may have been a better way to do this in batch, but after about 5 hours of looking i decided to just write my own. Wish i could have used powershell. Note:I found that using the net time //x.x.x.x command against a server can return different formatted results I think this script is able to handle the differences but i can not be certain without further testing
@echo off
REM Tony Unger
REM
REM login audit script
REM For Log In
Rem Writes to a CSV file
REM Thanks to http://brisray.com/comp/batch3.htm for length checking in batch
setlocal EnableDelayedExpansion
for /f "delims=" %%i in ('net time \\servername') do (
if "!CurrentTime!"=="" (set CurrentTime=%%i) else (set CurrentTime=!CurrentTime!#%%i)
)
echo %CurrentTime%
Echo parse the Net Time command
FOR /f "tokens=6,7,8" %%a IN ("%CurrentTime%") DO (
SET _date=%%a
SET _time=%%b
SET _AMPM=%%c
Echo after read ampm is %_AMPM%
If %_AMPM% ==AM#Local (
FOR /f "tokens=14,15,16" %%a IN ("%CurrentTime%") DO (
SET _date=%%a
SET _time=%%b
SET _AMPM=%%c
)
)
If %_AMPM% ==PM#Local (
FOR /f "tokens=14,15,16" %%a IN ("%CurrentTime%") DO (
SET _date=%%a
SET _time=%%b
SET _AMPM=%%c
)
)
Echo Now it is equal to: %_AMPM%
if %_HourUpdate% == 01 (set _HourUpdate=13)
Echo Break up the date to Day Month Year
for /f "tokens=1,2,3 delims=/ " %%A in ("%_date%") DO (
SET _Month=%%A
SET _Day=%%B
SET _Year=%%C
)
Echo Breakup Time to Hour Min Sec
for /f "tokens=1,2,3 delims=: " %%A in ("%_time%") DO (
SET _Hour=%%A
SET _Min=%%B
SET _Sec=%%C
)
Echo Removing spaces
set _Year=%_Year: =%
set _MonthUpdate=%_MonthUpdate: =%
set _Day=%_Day: =%
set _Hour=%_Hour: =%
set _Min=%_Min: =%
set _Sec=%_Sec: =%
REM
Echo Convert Month to two digits
set c=%_Month%
:Monthloop
if defined c (set c=%c:~1%&set /A _MonthCount += 1&goto Monthloop)
Echo Found %_MonthCount% in Month string
if "%_MonthCount%" LSS "2" (set _MonthUpdate=0%_Month%)
IF "%_MonthCount%" GTR "1" (set _MonthUpdate=%_Month%)
Echo %_MonthUpdate%
REM
Echo Convert Day to Two Digits
echo %_Day%
set c=%_Day%
:Dayloop
if defined c (set c=%c:~1%&set /A _DayCount += 1&goto Dayloop)
Echo Found %_DayCount% in day string
if "%_DayCount%" LSS "2" (set _DayUpdate=0%_Day%)
IF "%_DayCount%" GTR "1" (set _DayUpdate=%_Day%)
Echo %_DayUpdate%
REM
Echo Convert Hour to two digits
set c=%_Hour%
:Hourloop
if defined c (set c=%c:~1%&set /A b += 1&goto Hourloop)
Echo Found %b% in hour string
if "%b%" LSS "2" (set _HourUpdate=0%_Hour%)
IF "%b%" GTR "1" (set _HourUpdate=%_Hour%)
REM
Echo %_HourUpdate%
Echo Convert Hour to 24Hour
if %_AMPM%==PM#Local (
if %_HourUpdate% == 01 (set _HourUpdate=13)
if %_HourUpdate% == 02 (set _HourUpdate=14)
if %_HourUpdate% == 03 (set _HourUpdate=15)
if %_HourUpdate% == 04 (set _HourUpdate=16)
if %_HourUpdate% == 05 (set _HourUpdate=17)
if %_HourUpdate% == 07 (set _HourUpdate=19)
if %_HourUpdate% == 08 (set _HourUpdate=20)
if %_HourUpdate% == 09 (set _HourUpdate=21)
if %_HourUpdate% == 10 (set _HourUpdate=22)
if %_HourUpdate% == 11 (set _HourUpdate=23)
) ELSE (
if %_HourUpdate% == 12 (set _HourUpdate=00)
)
if %_AMPM%==PM#The (
if %_HourUpdate% == 01 (set _HourUpdate=13)
if %_HourUpdate% == 02 (set _HourUpdate=14)
if %_HourUpdate% == 03 (set _HourUpdate=15)
if %_HourUpdate% == 04 (set _HourUpdate=16)
if %_HourUpdate% == 05 (set _HourUpdate=17)
if %_HourUpdate% == 07 (set _HourUpdate=19)
if %_HourUpdate% == 08 (set _HourUpdate=20)
if %_HourUpdate% == 09 (set _HourUpdate=21)
if %_HourUpdate% == 10 (set _HourUpdate=22)
if %_HourUpdate% == 11 (set _HourUpdate=23)
) ELSE (
if %_HourUpdate% == 12 (set _HourUpdate=00)
)
REM
Echo Convert Mins to two digits
set c=%_Min%
:Minloop
if defined c (set c=%c:~1%&set /A _MinCount += 1&goto Minloop)
Echo Found %_MinCount% in minute string
if "%_MinCount%" LSS "2" (set _MinUpdate=0%_Min%)
IF "%_MinCount%" GTR "1" (set _MinUpdate=%_Min%)
Echo %_MinUpdate%
REM This is done incase seconds doesn't return as in older versions of windowss
if "%_Sec%"==" " SET _Sec=00
REM Remove Spaces from Strings
set _Year=%_Year: =%
set _MonthUpdate=%_MonthUpdate: =%
set _DayUpdate=%_DayUpdate: =%
set _HourUpdate=%_HourUpdate: =%
set _MinUpdate=%_MinUpdate: =%
set _Sec=%_Sec: =%
if not %_MonthUpdate%==is echo Log Off,%_Year%-%_MonthUpdate%-%_DayUpdate% %_HourUpdate%:%_MinUpdate%:%_Sec%,%COMPUTERNAME%,%USERNAME% >> \\servername\audit\%USERNAME%.csv
if %_MonthUpdate%==is echo %date:~10,4%-%date:~4,2%-%date:~7,2%,%COMPUTERNAME%,%USERNAME% >> \\servername\audit\errors.txt
Tuesday, May 28, 2013
Powershell: Get permissions on each vfiler cifs share.
Purpose: Get a list of all shares on each vfiler on each filer
Notes: This script needs some work with the nested foreach loops and some error check cleanup.
Import-Module dataontap
Function Get-ACLPermissions($Share){
$acl = Get-Acl -Path $Share
return $ACL
}
$myCol = @()
$AllNetappFiler = "filer03","filer02"
foreach ($NetappFiler In $AllNetappFiler){
write-host "Scanning $NetappFiler"
connect-nacontroller $NetappFiler | out-null
$Vfilers = get-navfiler * | Select -expand Name
foreach ($Vfiler in $Vfilers){
connect-nacontroller $Vfiler
$vfiler
$Shares = get-nacifsshare | Select -expand ShareName
foreach ($Share in $Shares){
Write-Host "$Vfiler insideloop"
#If $Vfiler Blank then scan shares on filer.. Need to add logic
$fullpath = "\\$Vfiler\$Share"
$ShareACL = Get-ACLPermissions $fullpath
$o = 0
$ShareACL.Access | ForEach-Object {
$Detail = New-Object PSObject
$Detail | Add-Member Noteproperty SystemName $NetappFiler
$Detail | add-member Noteproperty Vfiler $Vfiler
$Detail | Add-Member noteProperty Share $Share
$FileSystemRights = $ShareACL.Access[$o] | Select -ExpandProperty FileSystemRights #Example ReadAndExecute
$AccessControlType = $ShareACL.Access[$o] | Select -ExpandProperty AccessControlType #Example Allow/Deny
$IdentityReference = $ShareACL.Access[$o] | Select -ExpandProperty IdentityReference #Example Everyone,Username
$IsInherited = $ShareACL.Access[$o] | Select -ExpandProperty IsInherited #Are Permissions inherited
$InheritanceFlags = $ShareACL.Access[$o] | Select -ExpandProperty InheritanceFlags #Type of Inheritance ContainerInherit
$PropagationFlags = $ShareACL.Access[$o] | Select -ExpandProperty PropagationFlags #PropagationFlags
switch -wildcard ($FileSystemRights)
{
"268435456*" {$FileSystemRights = "FullControl"}
"-536805376*" {$FileSystemRights = "Modify, Synchronize"}
"-1610612736*" {$FileSystemRights = "ReadAndExecute, Synchronize"}
}
$Detail | Add-Member noteProperty IdentityReference $IdentityReference
$Detail | Add-Member noteProperty FileSystemRights $FileSystemRights
$Detail | Add-Member noteProperty AccessControlType $AccessControlType
$Detail | Add-Member noteProperty IsInherited $IsInherited
$Detail | Add-Member noteProperty InheritanceFlags $InheritanceFlags
$Detail | Add-Member noteProperty PropagationFlags $PropagationFlags
$o++
$myCol += $Detail
}
}
}
}
$myCol | Export-Csv -Path "c:\temp\Audit_NetappVfilerCifis.csv" -NoTypeInformation
Subscribe to:
Posts (Atom)
Powershell: Microsoft Graph to add new roles to application registration
PowerShell Script Bulk add new roles to application registration in azure. Update $roles with ,Us...
-
Here is an excel document I created that will ping a list of nodes in column A and give results in column B. There are much better tools th...
-
#reads event logs for filter and exports to $Date = ( Get-Date ).AddMinutes(-30) $LogName = 'Security' $ProviderName = ...
-
Running solidcore you may run into a problem where you have to disable it with out using epo or the local CLI Here are the steps. ...