https://www.google.com/search?client=firefox-b-d&q=install+rsat+windows+10+1909
and
https://gallery.technet.microsoft.com/Install-RSAT-for-Windows-75f5f92f
Download the ps1 Powershell file and execute it.
L | M | M | G | V | S | D |
---|---|---|---|---|---|---|
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 |
https://www.google.com/search?client=firefox-b-d&q=install+rsat+windows+10+1909
and
https://gallery.technet.microsoft.com/Install-RSAT-for-Windows-75f5f92f
Download the ps1 Powershell file and execute it.
This Powershell script executed with the correct rights:
Invoke-Command -ComputerName-ScriptBlock{Get-Service -Name MapsBroker | Set-Service -StartupType Disabled}
Connection String for quering an odbc AS400 database via powershell:
$query = "SELECT * FROM my_table"
$conn = New-Object System.Data.Odbc.OdbcConnection
$conn.ConnectionString = "Driver={iSeries Access ODBC Driver};System=my-as400-server;Uid=User;Pwd=Password;"
$conn.Open()
$cmd = New-Object System.Data.Odbc.OdbcCommand($query, $conn)
$cmd.CommandTimeout = 15
$ds = New-Object system.Data.DataSet
$da = New-Object system.Data.odbc.odbcDataAdapter($cmd)
[void]$da.fill($ds)
$conn.close()
$result = $ds.tables[0]
foreach ($Row in $ds.Tables[0].Rows) {
write-Output "$($Row.field1)"
write-Output "$($Row.field2)"
}
We can use net share command to create, configure and delete network shares from command line . Below you can find syntax and examples for net share command.
Create a network share from command line
The syntax for creating a share is as follows.
net share sharename=folderpath /grant:username,permissions sharename: You can assign name to the share you are going to create username : Login id of the user whom you want to share the folder with permission: Read, Change or Full
For example to share the folder E:\Docs with everyone in the domain and to give full permissions
net share Docs=E:\Documents /grant:everyone,FULL
If you are allowing multiple users to access the share, you can limit the number of users accessing the share simultaneously. This will prevent performance impact on your system. The below command will set the limit to 10 users.
net share Docs=E:\Documents /grant:everyone,FULL /users:10
Command to share with a specific user and to grant only read rights:
net share Docs=E:\Documents /grant:username,READ
Delete network share(i.e to disable sharing of the folder) from command line
net share sharename /delete
For example, to delete the share created above, the command would be as below.
net share docs /delete
Alternatively, we can use the folder physical location also to disable sharing
net share E:\Docs /delete
List the shared created on the local computer
net share
Delete the share on a remote computer
net share sharename \\remotepc /delete
function Get-MyDate{
[CmdletBinding()]
param(
[Parameter(Mandatory=$True,
ValueFromPipeLine=$True,
ValueFromPipeLineByPropertyName=$True,
HelpMessage="ComputerName or IP Address to query via WMI")]
[string[]]$ComputerName
)
foreach($computer in $computerName){
$timeZone=Get-WmiObject -Class win32_timezone -ComputerName $computer
$localTime = Get-WmiObject -Class win32_localtime -ComputerName $computer
$output =@{'ComputerName' = $localTime.__SERVER;
'Current Time' = (Get-Date -Day $localTime.Day -Month $localTime.Month);
}
$object = New-Object -TypeName PSObject -Property $output
Write-Output $object
}
}
get-mydate -ComputerName MyComputerName
This simple powershell script returns True o False if our object is of the same specified type or not.
<# $object contains my username string #> $object="MyUser" <# $type contains the type string (User or Group or Computer or OU) #> $type="User" $seek = [System.DirectoryServices.DirectorySearcher]"LDAP://dc=contoso,dc=com" $seek.Filter = “(&(name=$object)(objectCategory=$type))” Write-Host($seek.FindOne() -ne $null)
with this powershell script we’ll be able to get share permissions and ntfs permissions form all the shares of our servers list.
Function GetSharedFolderPermission($ComputerName) { #test server connectivity $PingResult = Test-Connection -ComputerName $ComputerName -Count 1 -Quiet if($PingResult) { #check the credential whether trigger if($Credential) { $SharedFolderSecs = Get-WmiObject -Class Win32_LogicalShareSecuritySetting ` -ComputerName $ComputerName -Credential $Credential -ErrorAction SilentlyContinue } else { $SharedFolderSecs = Get-WmiObject -Class Win32_LogicalShareSecuritySetting ` -ComputerName $ComputerName -ErrorAction SilentlyContinue } foreach ($SharedFolderSec in $SharedFolderSecs) { $Objs = @() #define the empty array $SecDescriptor = $SharedFolderSec.GetSecurityDescriptor() foreach($DACL in $SecDescriptor.Descriptor.DACL) { $DACLDomain = $DACL.Trustee.Domain $DACLName = $DACL.Trustee.Name if($DACLDomain -ne $null) { $UserName = "$DACLDomain\$DACLName" } else { $UserName = "$DACLName" } #customize the property $Properties = @{'ComputerName' = $ComputerName 'SharedFolderName' = $SharedFolderSec.Name 'SecurityPrincipal' = $UserName 'FileSystemRights' = [Security.AccessControl.FileSystemRights]` $($DACL.AccessMask -as [Security.AccessControl.FileSystemRights]) 'NTFS' = 0} $SharedACLs = New-Object -TypeName PSObject -Property $Properties $Objs += $SharedACLs } $Objs|Select-Object ComputerName,SharedFolderName,SecurityPrincipal,FileSystemRights,NTFS } } else { $Properties = @{'ComputerName' = $ComputerName 'SharedFolderName' = "Not Available" 'SecurityPrincipal' = "Not Available" 'FileSystemRights' = "Not Available" 'NTFS' = 0} $SharedACLs = New-Object -TypeName PSObject -Property $Properties $Objs += $SharedACLs $Objs|Select-Object ComputerName,SharedFolderName,SecurityPrincipal,FileSystemRights,NTFS } } Function GetSharedFolderNTFSPermission($ComputerName) { #test server connectivity $PingResult = Test-Connection -ComputerName $ComputerName -Count 1 -Quiet if($PingResult) { #check the credential whether trigger if($Credential) { $SharedFolders = Get-WmiObject -Class Win32_Share ` -ComputerName $ComputerName -Credential $Credential -ErrorAction SilentlyContinue } else { $SharedFolders = Get-WmiObject -Class Win32_Share ` -ComputerName $ComputerName -ErrorAction SilentlyContinue } foreach($SharedFolder in $SharedFolders) { $Objs = @() $SharedFolderPath = [regex]::Escape($SharedFolder.Path) if($Credential) { $SharedNTFSSecs = Get-WmiObject -Class Win32_LogicalFileSecuritySetting ` -Filter "Path='$SharedFolderPath'" -ComputerName $ComputerName -Credential $Credential } else { $SharedNTFSSecs = Get-WmiObject -Class Win32_LogicalFileSecuritySetting ` -Filter "Path='$SharedFolderPath'" -ComputerName $ComputerName } $SecDescriptor = $SharedNTFSSecs.GetSecurityDescriptor() foreach($DACL in $SecDescriptor.Descriptor.DACL) { $DACLDomain = $DACL.Trustee.Domain $DACLName = $DACL.Trustee.Name if($DACLDomain -ne $null) { $UserName = "$DACLDomain\$DACLName" } else { $UserName = "$DACLName" } #customize the property $Properties = @{'ComputerName' = $ComputerName 'SharedFolderName' = $SharedFolder.Name 'SecurityPrincipal' = $UserName 'FileSystemRights' = [Security.AccessControl.FileSystemRights]` $($DACL.AccessMask -as [Security.AccessControl.FileSystemRights]) 'NTFS' = 1} $SharedNTFSACL = New-Object -TypeName PSObject -Property $Properties $Objs += $SharedNTFSACL } $Objs |Select-Object ComputerName,SharedFolderName,SecurityPrincipal,FileSystemRights,NTFS -Unique } } else { $Properties = @{'ComputerName' = $ComputerName 'SharedFolderName' = "Not Available" 'SecurityPrincipal' = "Not Available" 'FileSystemRights' = "Not Available" 'NTFS' = "1"} $SharedNTFSACL = New-Object -TypeName PSObject -Property $Properties $Objs += $SharedNTFSACL $Objs |Select-Object ComputerName,SharedFolderName,SecurityPrincipal,FileSystemRights,NTFS -Unique } } Function LetsStart($ComputerName){ foreach($CN in $ComputerName){ GetSharedFolderNTFSPermission -ComputerName $CN GetSharedFolderPermission -ComputerName $CN } } $ComputerName="server01","server02","server03" $CurrentDate = Get-Date $CurrentDate = $CurrentDate.ToString('yyyy-MM-dd_HH-mm') LetsStart($ComputerName) | Export-Csv “c:\path\to\file\$CurrentDate.csv" -NoTypeInformation
restart-computer -ComputerName <computer_name> -Force
Pure Line theme by Theme4Press • Powered by WordPress Paolo Pizzolongo Chi è veramente ricco non ha bisogno dei soldi
Recent Comments